AS400 interview questions and answers-Part 1
1. What does ‘AS’ in AS400 stands for?
Ans: Application system.
2. What is ‘LPAR’?
Ans: OS/400 Version 4, introduced a feature LPAR (Logical PARtitioning) which facilitates running multiple operating
systems simultaneously on one IBM System i unit ensuring that one OS doesn’t
interfere other’s system resources/memory.
3. What is library is AS400? What are the types of library?
Ans: When we execute a command or call a program, the AS/400 must
know where to find the command or program and the answer is library. A Library
is a collection of objects. QSYS is the only library that contains other
library. QSYS is the root library where the entire user defined/ system defined
library is created. System supplied libraries begin with the letter
"Q" or "#".
Library
list types:
System library: All IBM supplied library e.g. QSYS, QHLPSYS,
QUSRSYS…
Product Library:
Whenever Ibm product is used it is added to the library automatically and is
removed itself when the job completes.
Current Library:
Current library is the working library i.e. all the work done by you is stored
in current library.
User Library: Non-IBM
supplied i.e. created by the user.
For more information related
to library and library commands: Click here...
4. Which library gets first loaded into the system when we login?
Ans: QSYS
5. What is the purpose of QGPL library?
Ans:
QGPL (General Purpose Library) is subpplied by IBM. Normally, commonly used objects are placed in QGPL. So, that it can be used by all the users signed into that system.
e.g.
We can use QGPL library in below cases:
Create an Output queues in QGPL so that the common printer can be used by everyone.
Create Commands in QGPL so that it can be used by all.
Transfer object to QGPL LIBRARY on remote system, so that those transferred objects can be used by different users.
In many cases, when you do not specify a library while creating object, then system will create object in QGPL.
e.g.
DSPFD FILE(ACCOUNT) TYPE(*MBR) OUTPUT(*OUTFILE) OUTFILE(*LIBL/OUT11111)
After running above command, OUT11111 will be placed in QGPL as we mentioned *LIBL in library which is not specific.
Hence system uses this general purpose library QGPL. Hence, this General purpose library is used by System as well as by users.
But, it is always advised to use your personal library instead of using QGPL.
6. How can we see all the objects and its sizes in a library?
Ans: By using the command DSPLIB.
Example: DSPLIB IROBO1
It gives you
the information of all objects that resides in the library with it size.
Display Library
Library . . . . . . : IROBO1 Number of objects . : 8
Type . . . . . . . . : PROD Library ASP number . : 1
Create authority . . : *EXCLUDE Library ASP device . : *SYSBAS
Type options, press Enter.
5=Display full attributes 8=Display service attributes
Opt Object Type Attribute Size Text
PRINT1PGM *PGM RPGLE 131072 rpgle program for pri
ACCOUNT *FILE PF 49152 ACCOUNT RELATED INFOR
PRINT1 *FILE PRTF 4096 PRINTER DDS RLU GENER
QCLSRC *FILE PF 8192 Sources CL-Programs
QDDSSRC *FILE PF 8192 DDS-Sourcen
QRPGLESRC *FILE PF 69632
QRPGLESRC2 *FILE PF 65536
QRPGSRC *FILE PF 8192 SOURCE PHYSICAL FILE
Bottom
F3=Exit F12=Cancel F17=Top F18=Bottom
7. What is source physical file?
Ans: Source physical file is a file
which contains the sources of different types of objects. There can be up to
32768 members. Source physical file is an object. But the source member is not
an object. When we compile the member, the object is created for that source.
Command used is CRTSRCPF.
CRTSRCPF
FILE(IROBO1/QRPGSRC) RCDLEN(112) TEXT('SOURCE PHYSICAL FILE’)
8. How to see all members of a file?
Ans: By using the command shown
below:
DSPFD
FILE(IROBO1/QRPGLESRC) TYPE(*MBRLIST)
9. How to see all record formats used in a file?
Ans: By using the command shown
below:
DSPFD
FILE(IROBO1/QRPGLESRC) TYPE(*RCDFMT)
10. How to change the record size of a physical file?
Ans: By using the command below:
CHGPF FILE(AMITNEM/OBJ) SRCFILE(AMINEM/QDDSSRC)
SRCMBR(OBJ_SRC)
We change the highlighted part to change the size of a
file.
Change Physical File (CHGPF)
Type choices, press Enter.
Physical file . . . . . . . . . Name
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB
System . . . . . . . . . . . . . *LCL *LCL, *RMT, *FILETYPE
Source file . . . . . . . . . . *NONE Name, *NONE
Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Member size:
Initial number of records . . *SAME 1-2147483646, *NOMAX, *SAME
Increment number of records . *SAME 0-32767, *SAME
Maximum increments . . . . . . *SAME 0-32767, *SAME
11. How can we arrange duplicate records in a file?
Ans: For this we will use file level
keywords FIFO/LIFO/FCFO in the physical file.
FIFO: The
duplicate key records will retrieved in first in first out order.
LIFO: The duplicate key records will
retrieved in last in first out order.
FCFO: The duplicate key records will
retrieved in first changed first out order.
12. How to refer another file to define a new field in a physical file?
Ans: below is an example,
we are going to use the file REFER to get the field definition for new file.
USE OF REFERENCE
Columns . . . : 1 71 Browse AMINEM/DDSSRC
SEU==> REFER
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0002.00 A R REF
0003.00 A RAC1 2P 0 COLHDG('LEVEL ID')
0004.00 A RAC2 3P 0 COLHDG('ORG CODE')
0005.00 A RAC3 12P 0 COLHDG('ACCOUNT NUM')
0006.00 A RAC4 3A COLHDG('ACCOUNT CURRENCY')
0007.00 A RPOSTCODE 2P 0 COLHDG('POST CODE')
0008.00 A RCOUNTRY 3P 0 COLHDG('COUNTRY CODE')
0009.00 A RNAME 20A COLHDG('NAME')
0010.00 A RDATE 3P 0 COLHDG('DATE')
****************** End of data ****************************************
Now we can refer the
file ‘REFER’ to take the field definition in the new file.
Columns . . . : 1 71 Browse AMINEM/DDSSRC
SEU==> USEREF
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
*************** Beginning of data *************************************
0002.00 A REF(REFER)
0003.00 A R USEREF
0004.00 A ACCLVL R REFFLD(RAC1 REFER) >>>>>> field name and
0005.00 ALIAS(ACC_LVL_ID) referred file name
0007.00 A ACCORG R REFFLD(RAC2 REFER)
0008.00 ALIAS(ACC_ORG_CODE)
0009.00 A ACCNUM R REFFLD(RAC3 REFER)
0010.00 ALIAS(ACC_NUM)
0011.00 A ACCCUR R REFFLD(RAC4 REFER)
0012.00 ALIAS(ACC_CUR)
0013.00 A ACCNAME R REFFLD(RNAME REFER)
0014.00 ALIAS(ACC_NAME)
****************** End of data ****************************************
13. Can LEVEL CHECK ERROR occur if we do CHGPF?
Ans: It depends on the
value that we have set for LVLCHK (Record format level check) attribute. If its
value is *YES then the record format level identifier is checked when the file
is opened and if it doesn’t match it throws the error. If its value is *NO,
then the record format level identifier is not checked, hence no error.