Occasionally you might need to send or receive a source member from/to your Windows PC and the IBMÂ i. Assuming your IBMÂ i has FTP enabled, it’s a snap to perform this task with Windows’ built-in FTP client.
To further explore FTP on Windows, see the list of Windows FTP commands .
To start FTP on Windows, open a DOS command line and type FTP
and press enter. Use the following commands to receive or a send a member from and to the IBMÂ i.
Use these FTP commands to retrieve an IBMÂ i source member to a PC file:
1 2 3 4 5 6 |
ftp open <IP address or server name> (Enter user ID and password as prompted) quote site namefmt 0 ascii get library/file.member pcfilename put pcfilename file.member |
The quote site namefmt 0
command enables the library/file.member
naming for the ftp get
and put
commands. See MC Press’s detailed explanation of namefmt
for more details (I’m pretty sure it was written by IBM midrange guru Joe Hertvik ). The ascii
command ensures you’re receiving or sending ASCII data.
Use these FTP commands to send a PC file to an IBMÂ i source member:
1 2 3 4 5 6 7 |
ftp open <IP address or server name> (Enter user ID and password as prompted) quote site namefmt 0 ascii get library/file.member pcfilename put pcfilename file.member |
When you use FTP to send a new member to the IBMÂ i, its source type and description won’t be set. Use PDM or the CHGPFM command to change those.
A bonus FTP tip
Here’s an interesting FTP tip that is perhaps more revealing than it is useful. Assuming you have the proper authority to the IBMÂ i object, you can use FTP to submit commands to the IBMÂ i. For example, if you wanted to use FTP to also set the source type and description for a member, you could call CHGPFM like this:
1 2 3 4 |
ftp open <IP address or server name> (Enter user ID and password as prompted) quote rcmd chgpfm file(rpglesrc/mylib) mbr(mymbr) srctype(RPG) > description('My source member') |
The last line above is continued with the >
character for publication purposes. That line, and the line before it, need to be a single line on the PC.
There are two take-aways here:
- FTP, in the right hands, can be pretty cool. I’ve hacked together a nice little workflow for myself that enables me to edit code on my PC, and quickly and easily get it to and from the IBMÂ i with FTP (Some things never change! I’ve been doing variations of this since 1991!). Enterprising programmers could easily build some handy batch files to automate this kind of FTP work.
- FTP, in the wrong hands, can wreak untold havoc! Keep your objects locked down with appropriate authorities and, if you’re going to use FTP with Windows and your IBMÂ i, consider adding an FTP exit program to your IBMÂ i for extra protection against FTP gone wild!