Q
Manage Learn to apply best practices and optimize your operations.

FTP user profile and password

Everything I see with FTP requires a user profile and password. I would prefer not to have this hard coded in the PC batch file, CLP, etc. What are some alternatives?

I'll tell you the way I do it. There are other ways, but I've found this method to be quite effective.

I store the FTP user ID and the FTP password in a secured data area. A user space would be another good choice.

I build the FTP session commands (or FTP Script) on the fly using an RPG or COBOL program, and store the session commands in a file in QTEMP.

I put a CL program wrapper around the whole thing, and it works nicely. The CL program must be secured, and adopt enough authority to read the Data Area.

The script for a simple file transfer is rather straightforward. Here's what typically on each line, and what your COBOL or RPG Program needs to build.

Line 1
FTPUSERID FTPPASSWORD
Line 2
PUT MYLIB/MYFILE YOURFILE
Line 3
QUIT

Here's the main slice of the CL code I use.

-----------------------------------------------------------------------

 
              CRTSRCPF   FILE(QTEMP/INPUT) MBR(INPUT)

              MONMSG CPF0000 Exec(Do)

                 CLRPFM     FILE(QTEMP/INPUT) MBR(INPUT)

              EndDo

 

              CRTSRCPF   FILE(QTEMP/OUTPUT) MBR(OUTPUT)

              MONMSG CPF0000 Exec(Do)

                 CLRPFM     FILE(QTEMP/OUTPUT) MBR(OUTPUT)

              EndDo

 

              OVRDBF     FILE(INPUT) TOFILE(QTEMP/INPUT) +

                                    MBR(INPUT)

 

              RTVDTAARA  DTAARA(FTPUSER (1 10)) RTNVAR(&FTPUSER)

              RTVDTAARA  DTAARA(FTPUSER (11 10)) RTNVAR(&FTPPASS)

 

              /* Build FTP Script  parameters are USERID and PASSWORD
*/                                    
             CALL       BUILDFTP PARM(&FTPUSER &FTPPASS)   /* Add
records to file QTEMP/INPUT  */            
 

             OVRDBF     FILE(OUTPUT) TOFILE(QTEMP/OUTPUT) +             
                                     MBR(OUTPUT)

                                                                        
            /* Do The FTP  SESSION */

           FTP RMTSYS(MYSYSTEM)

           /* Print the actual FTP session data for diagnostic purposes
*/                             
           CPYF FROMFILE(QTEMP/OUTPUT) TOFILE(*PRINT) 

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: Tips, tutorials and more.

Search400.com's targeted search engine: Get relevant information on security.

Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.

Read this Search400.com Featured Topic: Secure your iSeries

Dig Deeper on iSeries system and application security

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close