Pages

Wednesday, July 31, 2013

Useful tips for FTP

In my last post where I had discussed about image catalog using FTP of the ISO image. However, I did not discuss FTP in detail. Now, lets see some useful facts about FTP.

FTP can be done in two way GET and PUT :-

We can achieve the same result using both PUT and GET command. It is a two way process between the i-Series and the PC. Lets discuss with a example,

We want to transfer file abc.doc to iSeries system name Kelly. The file is at
C:\Documents and Settings\Sharmistha\My Documents

I want to transfer the document abc.doc to iSeries library QGPL

When I do it from my PC the command would be,

Go to command prompt

C:\Documents and Settings\Sharmistha\My Documents

Start FTP from this location to your iSeries system,

C:\Documents and Settings\Sharmistha\My Documents\ ftp kelly(ip address)

this will ask for login id and password. After you enter the system, do the following.

ftp> quote site namefmt 1 ( this is done for objects are defined in OS400  IFS format)

ftp> bin ( object transferred in binary form)

ftp> PUT abc.doc  /qsys.lib/qgpl.lib/abc.doc

This will transfer from PC to iSeries. Now, we can do the same using GET command,


:\Documents and Settings\Sharmistha\My Documents

Start FTP from this location to your iSeries system,

C:\Documents and Settings\Sharmistha\My Documents\ ftp kelly(ip address)

this will ask for login id and password. After you enter the system, do the following.

ftp> quote site namefmt 1 ( this is done for objects are defined in OS400  IFS format)

ftp> bin ( object transferred in binary form)

ftp> GET /qsys.lib/qgpl.lib/abc.doc abc.doc


Save files (SAVF) are great for transferring iSeries and AS/400 objects between OS/400-based machines. Whether it's a group PTF, a file, a library or even a licensed program, save files can quickly zip large amounts of information between two AS/400s, especially if the save files are transmitted via FTP.

Few things to keep in mind when using FTP:-

1- BINARY :- Binary transfers mean that OS/400 FTP will create an exact mirror image of your save file on your target machine. The file is transferred bit-by-bit, and it is reassembled on the receiving machine exactly as it looks on the sending machine, with no EBCDIC translation performed. Incidentally, this also helps speed up your FTP transfer.

2- NAMEFMT :- This is used to specify how the objects in OS400 are defined. NAMEFMT 1 is for IFS format and NAMEFMT 0 is for library/object format. When you use NAMEFMT 0 , the save file must be previously created in target AS400, to enable the transfer of  save file between systems. If this save file is not created, mostly the system would create a new physical file and store the save file in it which is not what you want. So, it is advisable to create save file in target system before FTP'ing.

When using NAMEFMT 1, in which Integrated file system nomenclature is used, the system automatically creates the save file, when you have used IFS naming convention and also you have mentioned .savf file extension.

Example,

PUT /qsys.lib/ssahoo.lib/abc.savf  /qsys.lib/target.lib/abc.savf

3- Empty target save file for correct FTP :-  If you have created the target save file newly or if it is empty then the FTP completes successfully. You can use CRTSAVF command to create save file in target system or use CLRSAVF command to clear the existing save file in target system.

4- Using RCMD from command prompt :- You can also use RCMD command from PC command prompt to execute AS400 command in the iseries system.

Example,

QUOTE RCMD CRTSAVF FILE(SSAHOO/ABC) TEXT('SAVE FILE FOR TARGET MACHINE)







No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...