One of the regular jobs we are doing in most of our mainframe job is doing copy of our job result to some other server data base. The FTP (File transfer protocol) utility is commonly used for copying file to and from other source.
//STEP1 EXEC PGM=FTP,PARM='(EXIT',REGION=2048K
//INPUT DD *
IP ADDRESS
REMOTE USER ID
REMOTE PASSWORD
CD DIRECTORY
PUT ‘INPUT – DATASET ’ OUTPUT – FILE NAME (receiving file)
QUIT
//OUTPUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
Commands used in FTP
quit – Exit the FTP
cd - To change the directory in the remote machine
ascii – Mode of transfer is ascii
binary – Mode of transfer is binary
delete - To delete the file from current remote directory
get - To copy a file from remote machine to our specified local machine
put - To copy our local machine file to remote directory
lcd - To change the directory on local machine
ls - To list the files available in current remote directory
mkdir - Create one new directory in current remote directory
mput - To copy multiple files from local machine to remote directory
mget - To copy multiple files from remote directory to local machine
open – To open connection with another machine
One common error we encountered while performing FTP is “Broken Pipe “ error. That means insufficient space in remote server. For that we can delete old version file from remote server using “DELETE” command before transferring file using “PUT” command.