Friday, September 21, 2007

FTP Between PC and AS400

Here's an example of how to FTP between machines, such as between a PC and an AS400. I save this in a file that I give a .ftp suffix to:
your-remotesystem-user-id
your-remotesystem-password
quote site crtccsid 37
cd path/to/target/location
put EMR.xml EMR400XML
put measures.xml EMRMSRXML
binary
put DISBUR~1.BIN EMRDISBBIN
put EMRRUL~1.BIN EMRRULEBIN
put ITRULE~1.BIN EMRITRUBIN
put LENDER~1.BIN EMRLENDBIN
put UNAUTH~2.BIN EMRUNDIBIN
put UNAUTH~1.BIN EMRUNAUBIN
put model.bin EMRMODBIN
quit
And, a MS-DOS batch file is needed to run the FTP script. I create a batch file with the same name as the script but, of course, with a .BAT suffix. This is an example:
ftp  -v  -s:emr.ftp  myas400
The syntax being:
ftp  -v  -s:${name-of-script}.ftp  ${name-of-as400}
To run the script, execute the .bat file. There are two ways to navigate the library and folder systems on an AS400 or iSeries. The default naming system is "namefmt 0" and it displays objects, tables and members using regular AS400 naming conventions. To work with IFS folders and the Library system using directory structure naming system, issue the command (either in the script or interactively)
quote site namefmt 1
To return to conventional AS400 naming, issue:
quote site namefmt 0