A) Starting ftp from my PC to the 400
From your PC do the following:
Start
Run
cmd
From the command interface window:
ftp your400name
Enter your userid
Enter your password
For a list of commands type in ? and hit enter
By default you will be in the library system. To change to the directory
system then enter: quote site namefmt 1
To change to the library system: quote site namefmt 0
get is used to get a file from the remote to the local.
put is used to put a file to the remote from the local.
Here is a sample used to run a command on the 400:
quote rcmd crtpf mylib/myfile rcdlen(80)
quit is used to exit.
When transmitting a save file to the 400, the save file should already
exist. Also you should use the bin command to transmit the file in
binary.
B) Starting ftp from my 400 to another 400
Very similar to starting ftp from a pc to the 400.
Differences include:
While you still use ? to prompt for commands the prompting appears
different.
C) Starting ftp from my 400 to a PC.
You'll need to ensure that the PC has a ftp server loaded. Windows comes
with one, but normally you have to load that separately. There are
others available.
II) Automated, or scripting, method
A) Scripted ftp from the pc to the 400.
First create a .BAT file. Let's call ours FTPSCRIPT.BAT. In it we'll
have one line:
ftp -n -s:ftpscript.txt>ftpout.txt
The -n says not to open a system until we say so.
The -s says to used a script file and this is the name of the script file.
The >ftpout.txt will pipe the output to a text file. You can check this
file for transmission errors.
Now create another text file called FTPSCRIPT.TXT. In this place:
open myas400
user myuserid mypassword
cd mylib
quote rcmd crtpf mylib/myfile rcdlen(80)
put myfile.txt myfile
quote rcmd runpost
quit
Now when you type ftpscript it will run the ftpscript.bat file, which
will use the ftpscript.txt file. You can use notepad or some other
utility to check the ftpout.txt file for the status of the transmission.
An important thing to remember is that the command we used, runpost, will
have to set up the library list. It will not use any library list
defined by your user profile's job description.
B) Scripted ftp from 400 to another server.
First create a simple CL program. Let's call ours FTPSCRIPT. In it we'll
have these lines:
PGM PARM(&RMTSYSTEM)
DCL VAR(&RMTSYSTEM) TYPE(*CHAR) LEN(200)
OVRDBF FILE(INPUT) TOFILE(MYLIB/FTPSCRIPT)
OVRDBF FILE(OUTPUT) TOFILE(MYLIB/FTPOUTPUT)
FTP RMTSYS(&RMTSYSTEM)
DLTOVR FILE(INPUT)
DLTOVR FILE(OUTPUT)
CALL PGM(ANALYZER) /* Analyze FTP output */
ENDPGM
The file MYLIB/FTPSCRIPT should be a one field file. The record length
is pretty flexible.
The file MYLIB/FTPOUTPUT should also be a one field file. Again, the
record length is pretty flexible.
In the file MYLIB/FTPSCRIPT put the following
<- There should be one blank line first. This cancels
prompting for the user name and password. The user
statement will handle that.
user myuserid mypassword
cd mylib
quote rcmd crtpf mylib/myfile rcdlen(80)
put myfile.txt myfile
quote rcmd runpost
quit
Now when you type CALL FTPSCRIPT it will run the CL program FTPSCRIPT,
which will use the FTPSCRIPT file. You can use DSPPFM or some other
utility to check the FTPOUTPUT file for the status of the transmission.
The program analyzer would be written to check out the contents of
FTPOUTPUT and process accordingly.
An important thing to remember is that the command we used, runpost, will
have to set up the library list. It will not use any library list
defined by your user profile's job description
No comments:
Post a Comment