AS400 interview questions and answers-Part 9


1. What is FTP in AS400? What are the FTP commands in AS400?

Ans:  We are using FTP in as400 to send and receive data from/to remote system.

Below are the basic FTP commands in the transfer:

 

§  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”

 

§  GET library/source-physical-file. Member-name

This command is used to fetch a file from remote system.

e.g.

GET AMINEM/QRPGLESRC.DSPPGM

This can be used to fetch save-file also:

   GET SAV005

 

If Member SAV005 in file SAV005 in library QGPL already exists. Specify

REPLACE as a subcommand option as shown below.

   GET SAV005 (REPLACE

 

§  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

 

§  MPUT: To send multiple files to remote system

It is used to fetch multiple file from remote system, GENERIC IS ALLOWED.

e.g.

MGET aminem.*  aminem1.*

 

§  NAMEFMT (name formatting)

 

Its value can be 0 or 1, it has been explained below.

 

§  QUOTE SITE NAMEFMT 0

ü  For working with standard library objects

ü  File identifiers have three components: Library, File and member.

ü  Library and file components are separated by the / delimiter.

ü  File and member components are separated by the . delimiter.

ü  Syntax: Library/file.member

Example

– PUT something.txt QGPL/QCLSRC.TEST

– CD QGPL

– PUT something.txt QCLSRC.TEST

 

 

§  QUOTE SITE NAMEFMT 1

ü  For working with IFS objects (ie. All objects)

ü  Directory levels separated by the / delimiter.

ü  Database files use format: /QSYS.lib/Libname.lib/Fname.file/Mname.mbr

ü  Documents (files) stored in folders use format: /QDLS/folder/document.ext

ü  CD / (puts you in the root IFS folder)

 

§  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 default mode for most FTP programs)

ü  ASCII  is a character-encoding scheme originally based on the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text. Most modern character-encoding schemes are based on ASCII, though they support many additional characters.

e.g.

ftp> ascii

 

ftp> put d:\path1\filename1.txt

 

200 PORT command successful.

Opening ASCII mode data connection for filename1.txt

226 Transfer complete

 

 

§  Binary

ü  It Sets the file transfer mode to Binary

ü  the binary mode transfers all eight bits per byte and must be used to transfer non-ASCII files or non-standard files e.g. zip file, tar file, image file, .DAT file, save file, executable files, sound files, graphic files etc.

e.g.

ftp> binary

ftp> put d:\path1\filename1.zip

200 PORT command successful.

Opening BINARY mode data connection for filename1.zip

 

§  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

 

2. How can we transfer data from one AS400 to another AS400 system?

Ans:

Example- I : Transferring data from one AS400-system to another AS400-system

 


                                     File Transfer Protocol
 
Previous FTP subcommands and messages:
Connecting to host SYSTEM442.HOST123.com at address 10.123.148.241 using port 21.
220-QTCP at SYSTEM442.
220 Connection will close if idle more than 50 minutes.
> IROBO             >>>>>> Enter USER NAME here
331 Enter password. >>>>>> Enter PASSWORD here
230 IROBO logged on.
OS/400 is the remote operating system. The TCP/IP version is "V5R3M0".
250  Now using naming format "0".
257 "QGPL" is current library.
> CD AMINEM
250 "AMINEM" is current library.
> LCD AMINEM
Local working directory is AMINEM
 
> PUT RPGSRC.ADDCL  RPGSRC11.ADDCL1
227 Entering Passive Mode (10,123,148,241,231,148).
150 Sending file to member ADDCL1 in file RPGSRC11 in library AMINEM.
250 File transfer completed successfully.
                        
> PUT QCBLLESRC.SRC03A00   QCBLLESRC.SRC03A00
227 Entering Passive Mode (10,123,148,241,209,50).
150 Sending file to member SRC03A00 in file QCBLLESRC in library AMINEM.
250 File transfer completed successfully.
8003 bytes transferred in 0.202 seconds. Transfer rate 39.590 KB/sec.

 

 

Example- II : Transferring AS400 objects from one AS400-system to another AS400-system using save file

 

To download source member from telnet system SYS5005 è SYS4004 è Local disk

 

§  In System SYS5005 from which the object QRPGLESRC is to be sent, we do the below steps:

 

CRTLIB TRANSFER

 

CRTSRCPF FILE(TRANSFER/QRPGLESRC) RCDLEN(112) è Put here all the members required.

 

CRTSAVF QGPL/SAV005

 

SAVOBJ OBJ(QRPGLESRC) LIB(TRANSFER) DEV(*SAVF) SAVF(QGPL/SAV005) TGTRLS(V5R4M0)

 

 

§  In System SYS4004 where  the object QRPGLESRC is to be restored, we do the below steps:

 

 

CRTSAVF QGPL/SAV005

 

CRTLIB GETLIB

 

FTP SYS5005

 

 
File Transfer Protocol
 
Previous FTP subcommands and messages:
Connecting to host SYS5005 at address 164.4.32.67 using port 21.
220-QTCP at SYS5005.IS.SANDVIK.COM.
220 Connection will close if idle more than 5 minutes.
> NAPULIP
331 Enter password.
230 NAPULIP logged on.
OS/400 is the remote operating system. The TCP/IP version is "V7R1M0".
250  Now using naming format "0".
257 "QGPL" is current library.
> BIN
200 Representation type is binary IMAGE.
> GET SAV005
Member SAV005 in file SAV005 in library QGPL already exists.
Specify REPLACE as a subcommand option.
> GET SAV005 (REPLACE
227 Entering Passive Mode (164,4,32,67,172,230).
Enter an FTP subcommand.
   > QUIT
 
===> ------------------------------------------------------------------------------
------------------------------------------------------------------------------------
F3=Exit     F6=Print       F9=Retrieve
F17=Top    F18=Bottom    F21=CL command line

   


RSTOBJ OBJ(*ALL) SAVLIB(TRANSFER) DEV(*SAVF) SAVF(QGPL/SAV005) RSTLIB(GETLIB)         

                  

 

*** 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)  

  

 

Example- III : Transferring AS400 objects from AS400-system SYSTEM01to local drive using FTP in batch mode

 

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:

 


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
 
C:\Users\ajaiswal>CD C:\Users\ajaiswal\Documents\My data
 
C:\Users\ajaiswal\Documents\My data>ftp -s:FTP001.txt SYSTEM01
Connected to SYSTEM01.com.
220-QTCP at SYSTEM01.COM.
220 Connection will close if idle more than 5 minutes.
User (SYSTEM01.com:(none)):
331 Enter password.
 
230 AJAISWAL logged on.
ftp> ASCII
200 Representation type is ASCII nonprint.
ftp> QUOTE SITE NAMEFMT 0
250  Now using naming format "0".
ftp> GET AMITCCCC/QRPGLESRC.BIN_EOF    EOF.txt
200 PORT subcommand request successful.
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> GET AMITCCCC/QRPGLESRC.BIN_INTH   INTH.txt
200 PORT subcommand request successful.
150 Retrieving member BIN_INTH in file QRPGLESRC in library AMITCCCC.
226 File transfer completed successfully.
ftp: 544 bytes received in 0.00Seconds 544000.00Kbytes/sec.
ftp> GET AMITCCCC/QRPGLESRC.BIN_MINUTE MINUTE.txt
200 PORT subcommand request successful.
150 Retrieving member BIN_MINUTE in file QRPGLESRC in library AMITCCCC.
226 File transfer completed successfully.
ftp: 578 bytes received in 0.00Seconds 578000.00Kbytes/sec.
ftp> GET AMITCCCC/QRPGLESRC.BIN_MONTH  MONTH.txt
200 PORT subcommand request successful.
150 Retrieving member BIN_MONTH in file QRPGLESRC in library AMITCCCC.
226 File transfer completed successfully.
ftp: 576 bytes received in 0.00Seconds 576000.00Kbytes/sec.
ftp> GET AMITCCCC/QRPGLESRC.BIN_MSEC   MSEC.txt
200 PORT subcommand request successful.
150 Retrieving member BIN_MSEC in file QRPGLESRC in library AMITCCCC.
226 File transfer completed successfully.
ftp: 604 bytes received in 0.00Seconds 604000.00Kbytes/sec.
ftp> QUIT
221 QUIT subcommand received.
 
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.

 

 

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.

 


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
 
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

 

 

3. What is the difference between NAMEFMT 0 and NAMEFMT 1?

 In case of namefmt 0

·         get {library}/{save_file_name}.savf {save_file_name}.savf (replace

In case of namefmt 1

·         get /qsys.lib/{library}.lib/{save_file_name}.savf {save_file_name}.savf (replace

 

§  NAMEFMT  0

 


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
 
C:\Users\ajaiswal>CD C:\Users\ajaiswal\Documents\My data
 
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> QUOTE SITE NAMEFMT 0
250  Now using naming format "0".
ftp> GET AMITCCCC/QRPGLESRC.BIN_EOF EOF_NEW.txt
200 PORT subcommand request successful.
150 Retrieving member BIN_EOF in file QRPGLESRC in library AMITCCCC.
226 File transfer completed successfully.
ftp: 1407 bytes received in 0.09Seconds 14.97Kbytes/sec.

 

   

§  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.

 

 

4.        How to send objects from one system to another using SNDNETF?

 

Ans: 

Here we will send the file from system SYSTEM401 to SYSTEM405

 

SYSTEM401 system

 

(1)      Create save file in production

(2)      Save object by using the save file previously created.

(3)      Send the file to userid of target system.

 

CRTSAVF FILE(QTEMP/SAV001)                                             

File SAV001 created in library QTEMP.                                  

 

SAVOBJ OBJ(TOTAL SMART DCPS SPP) LIB(QTEMP) DEV(*SAVF) SAVF(QTEMP/SAV001)

4 objects saved from library QTEMP.                                     

 

SNDNETF FILE(QTEMP/SAV001) TOUSRID((USER405 SYSTEM405))                

File SAV001 in QTEMP member SAVF sent to 1 users. Not sent to 0 users.

 

 

SYSTEM405 system

 

(1)      WRKNETF

(2)      Create save file in SYSTEM405

(3)      Use option 1 against the file to retrieve it.

(4)      Restore all the object to restore-library.

 

WRKNETF
CRTSAVF FILE(QTEMP/SAV001)  
RSTOBJ OBJ(*ALL) SAVLIB(QTEMP) DEV(*SAVF) SAVF(QTEMP/SAV001) RSTLIB(AMI001)

 

 




 

 







User Comments:



Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy