[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Complete FTP session from a CL program



Sender: "Buck Calabro" <Buck.Calabro@xxxxxxxxxxxx>

Scott is on vacation, but he managed to put the FTP command line CL and RPG on his web site here http://www.scottklement.com/ftpapi/contrib/ftpcmdline/

Because it's a first cut, there aren't any format instructions.  Basically, compile the command FTPCMD and make the program (PGM) parameter point to FTPRPG.  Then, compile the RPG program.  I have the binding directory FTPAPI in my library list, so it compiles without any prompting.  I do use DBGVIEW(*LIST), and ACTGRP(QILE).  If the activation group doesn't suit your needs, feel free to change it.  The program is standalone, and doesn't (intend to) share anything, so it should run in *CALLER just as well.  The only entry in my BNDDIR(FTPAPI) is FTPAPIR4.

Once the command and RPG are compiled, just prompt the command and fire away.  I have a pair of iSeries boxes that I FTP between, so that's what I tested first.  To send a file from AS400A to AS400B:

FTPCMD DIRECTION(*SND)                                       
       HOSTNAME(AS400B)                                    
       USERNAME(buck)
       PASSWORD()
       LOCAL('/qsys.lib/aptgenbu1.lib/ftpapisrc.file/ftpcmd.mbr')                                           
       REMOTE('/qsys.lib/buck.lib/ftpapisrc.file/ftpcmd.mbr')

At the moment, you have to specify the files in *PATH format.  The command will log what it is doing to the job log.  Note that the password is non-display, and it doesn't show in the joblog, either.

I have an FTP server running on my PC, and I can send files there, too:

FTPCMD DIRECTION(*SND)                                       
       HOSTNAME('555.555.555.555')                              
       USERNAME(buck)                                        
       PASSWORD()
       LOCAL('/qsys.lib/buck.lib/ftpapisrc.file/ftpcmd.mbr') 
       REMOTE('upload/ftpcmd.cmd')                           

Getting files from the other side is as easy as changing the first parameter from *SND to *RCV.

Since this is a first cut, any thoughts on the parameters is welcome, including using *GET/*PUT instead of *RCV/*SND, or moving the order of the parameters (say, host name first?)

The other parameters should be self-descriptive:

NAMEFMT(*PATH) - for future use to use DB2 nomenclature
PORT(*DFT)     - Specify the port the FTP server is listening on
PASSIVE(*NO)   - SENDPAsv
BINARY(*NO)    - BINary

  --buck
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------