We are using FTP in as400 to send and receive data from/to remote system.
(3) AFTER THE CONNECTION IS DONE, USE LCD TO CHANGE THE DRIVE AS LOCAL DRIVE
LCD C:\folder\onpc\where\stuffis
***If we give the same source file/member name, then the source code will be copied
else we will get only data file for that member which we are sending or receiving.
(7) MGET AND MPUT IS USED TO GET AND PUT MULTIPLE FILE, GENERIC IS ALLOWED
(8) QUIT
LCD directory-name
This command is used to change the Local system directory to
directory-name.
e.g.
LCD Library-name
LCD C:\folder\onpc\where\stuffis
LCD C:\Program Files
CD directory-name
This command is used to change the Remote system directory to
directory-name.
e.g.
CD Library-name
CD C:\folder\onpc\where\stuffis
CD C:\Program Files
MGET:
It is used to fetch multiple file from remote system, GENERIC IS
ALLOWED.
e.g.
MGET aminem.* aminem1.*
PUT:
To send a file to remote system
e.g.
PUT RPGSRC.ADDCL RPGSRC11.ADDCL1
ALLOWED.
e.g.
MGET aminem.* aminem1.*
Syntax: Library/file.member
Example
PUT something.txt QGPL/QCLSRC.TEST
CD QGPL
/QSYS.lib/Libname.lib/Fname.file/Mname.mbr
/QDLS/folder/document.ext
QUIT
Ends the FTP session with the remote computer and exits ftp.
Bye
Ends the FTP session with the remote computer and exits ftp.
ASCII
It Sets the file transfer mode to ASCII (Note: this is the
e.g.
ftp> ascii
Binary
It Sets the file transfer mode to Binary
the binary mode transfers all eight bits per byte and must be
file, tar file, image file, .DAT file, save file, executable
e.g.
ftp> binary
Quote
It will send an argument to the remote FTP Server. This statement
is similar in purpose as the "LITERAL" statement.
Site
This parameter is used at the client system to transfer a
function (via the LITERAL or QUOTE statement) to the host site.
e.g.
We can change the naming format to 0 with the command as shown
below.
QUOTE SITE NAMEFMT 0
Open
It opens a new FTP connection with another system.
e.g.
Open system-name
To download source member from telnet system SYS5005 SYS4004 Local disk
CRTSAVF QGPL/SAV005
CRTSAVF QGPL/SAV005
CRTLIB GETLIB
FTP SYS5005
===>
------------------------------------------------------------------------------
---------------------------------------------------------------------------------
---
F3=Exit F6=Print F9=Retrieve
F17=Top F18=Bottom F21=CL command line
*** For save file BIN(binary) command is needed as the savefile cannot be dealt With
default ASCII.
In GETLIB the object QRPGLESRC has been restored. To see the members do,
WRKMBRPDM FILE(GETLIB/QRPGLESRC)
a) First of all we make a text file FTP001.txt containing below FTP commands.
FTP001.txt
AJAISWAL
AJAISWAL
ASCII
QUOTE SITE NAMEFMT 0
GET AMITCCCC/QRPGLESRC.BIN_EOF EOF.txt
GET AMITCCCC/QRPGLESRC.BIN_INTH INTH.txt
GET AMITCCCC/QRPGLESRC.BIN_MINUTE MINUTE.txt
GET AMITCCCC/QRPGLESRC.BIN_MONTH MONTH.txt
GET AMITCCCC/QRPGLESRC.BIN_MSEC MSEC.txt
QUIT
b) Then we go to CMD and run the command below:
C:\Users\ajaiswal\Documents\My data>EXIT
Hence we have received the text files INTH.txt, MINUTE.txt, MONTH.txt, and
MSEC.txt for the as400 objects.
Command-line options
-d - Enables debugging, displaying all ftp commands passed between the client and
server.
-s:filename - Specifies a text file containing ftp commands; the commands will
automatically run after ftp starts. No spaces are allowed in this parameter. Use this switch
instead of redirection (>).
Example IV : Send data from one system to another using
command prompt
In the below example, we are transferring savfile SAV001 from system
SYSTEM01 to system SYSTEM02.
C:\Users\ajaiswal>CD DOCUMENTS
C:\Users\ajaiswal\Documents>FTP SYSTEM01
Connected to SYSTEM01.com.
220-QTCP at SYSTEM01.com
220 Connection will close if idle more than 5 minutes.
User (SYSTEM01.com:(none)): AMIT
331 Enter password.
Password:
230 AMIT logged on.
ftp> CD AMITCC
250 "AMITCC" is current library.
ftp> BIN
200 Representation type is binary IMAGE.
ftp> GET SAV001
200 PORT subcommand request successful.
150 Retrieving member SAV001 in file SAV001 in library AMITCC.
226 File transfer completed successfully.
ftp: 1989504 bytes received in 17.39Seconds 114.38Kbytes/sec.
ftp> QUIT
221 QUIT subcommand received.
C:\Users\ajaiswal\Documents>ftp SYSTEM02
Connected to SYSTEM02.com.
220-QTCP at SYSTEM02.COM.
220 Connection will close if idle more than 5 minutes.
User (SYSTEM02.com:(none)): AMIT
331 Enter password.
Password:
230 AMIT logged on.
ftp> bin
200 Representation type is binary IMAGE.
ftp> cd amitccc
250 "AMITCCC" is current library.
ftp> put sav001
200 PORT subcommand request successful.
150 Sending file to member SAV001 in file SAV001 in library AMITCCCC.
226 File transfer completed successfully.
ftp: 1989504 bytes sent in 11.12Seconds 178.86Kbytes/sec.
ftp> QUIT
In case of namefmt 0
In case of namefmt 1
NAMEFMT 0
NAMEFMT 1
C:\Users\ajaiswal\Documents\My data>FTP SYSTEM01
Connected to SYSTEM01.com.
220-QTCP at SYSTEM01.COM.
220 Connection will close if idle more than 5 minutes.
User (SYSTEM01.com:(none)): AJAISWAL
331 Enter password.
Password:
230 AJAISWAL logged on.
ftp> GET /QSYS.LIB/AMITCCCC.LIB/QRPGLESRC.FILE/BIN_EOF.MBR KKK.txt
200 PORT subcommand request successful.
150-NAMEFMT set to 1.
150 Retrieving member BIN_EOF in file QRPGLESRC in library AMITCCCC.
226 File transfer completed successfully.
ftp: 1407 bytes received in 0.02Seconds 87.94Kbytes/sec.
ftp> quit
221 QUIT subcommand received.