Mainframe AS400 Interview Questions
Mainframe AS400 Interview Questions
Q.What is the maximum number of records you can specify in a display file?
A.1024
Q.How can a screen field that has changed since the last output operation be detected ?
A.Attach the MDT (modified data tag) attribute to the field, to detect whether field has been changed as a result of
user input.
Q.What would be the effect on the field where reverse image, underline and highlight display attributes were active?
A.The result is same as if you had specified ND.
Q.If DSPATR(PC) and CSRLOC were specified for a format, which keyword would have priority?
A.CSRLOC gains priority.
Q.How can a message from a message file appear as a constant on the screen?
A.By using MSGCON (message constant) keyword.
Q.In conjunction with what other keyword must OVRDTA and OVRATA be used?
A.PUTOVR keyword must used.
Q.What is Subfile?
A.Subfile is group of records of same record format and can be read from or write to the display in a single
operation.
Q.What is the maximum number of subfiles that can be specified in a display file,
A.512
Q.Maximum number of subfiles that can Defined in a RPG program for one display file is
A.24
Q.Maximum number of subfiles that can be active for a single file is?
A.12
Q.How to pick up the changed records every time in a subfile after the first change made?
A.Seton SFLNXTCHG keyword indicator and update the subfile record.
Q.How to toggle between single line and Multi - line display of a particular record in a subfile?
A.Using SFLDROP keyword.
Define what the operation will do, the purpose of the result field and the purpose of *IN66?
HI LO EQ
C CALL 'CVTDAT' DTPRM 66
Ans:The above statement causes, call the program and pass the parameter.
Define the purpose of the following code (If you know, how would this be written in RPG ILE)
HI LO EQ
C *IN66 DOUEQ *OFF
C KEY1 CHAIN FILEA 90 66
C 66 CALL PGM1 PRM
C ENDDO
Ans:Whenever the indicator *IN66 becomes *OFF, the control transfers after ENDDO statement.
Otherwise, it reads the records from the data base file based on indicator specified on HI position. If the
specified indicator on LO position becomes *OFF, then only CALL statement will execute.
How do you set the keywords SFLSIZ and SFLPAG if you want the subfile to dynamically expand?
Ans:SFLSIZ > SFLPAG.
How can you detect overflow for a print program that prints multiple lines per cycle?
Ans:You specify the indicators OA through OG and OV in 33 - 34 columns in a printer file. This indicator
automatically set on whenever overflow occurs on a type of page.
What is the difference between array and a multiple occurrence data structure?
Ans:The values stored in array don’t vary. In the other hand, we can store the
Different values in same variables at various stages.
How can you execute a command from within an RPG program without calling a CLP program?
Ans:By calling QCMDEXC application program interface we can execute a CL command with in an RPG
program.
What is the purpose of the "N" in the following calculation specification?
Ans:C KEY CHAIN FILE N 99.If you specify 'N' in 53rd position, the record will not be locked if you try to
read the locked record. It is a way of avoiding the record lock.
Which are the four keywords supported by Program Status Data Structure?
Ans:*STATUS, *PARM, *ROUTINE & *PROGRAM
What is SQL?
Ans:SQL is an interface for programming language.
Which are the Query selection criteria, which can be given in a Query?
Ans:LIST
To add a file to the ‘File Selection’ option of a Query, the function key to be pressed is?
Ans:F9
What is the values SQLCOD when there is an error in fetching the records specified in the select
statement?
Ans:-ve value
What is a Journal?
Ans:A Journal is an object used primarily to record changes to data in a PF.
Q.How can the user implicitly open and close the files in RPG program ?
A.Enter UC in position 71-72 of F specs.
Use OPEN and CLOSE opcodes in RPG program to open and close files.
Q.When will you use OPEN and CLOSE opcodes in RPG program?
A.If you specify the letter "U" at columns 73 - 74 in a file description specification indicating that user
control on a file. Hence we have to explicitly open and close the file in a program.
Q.What is the difference between externally described file and program described file?
A.The field definitions and descriptions are defined out side of the program in a externally described file.
The field definitions and descriptions are defined in side the program in a program described file.
BL Blinking field ,HI High Intensity ,RI Reverse Image ,CS Column separator ,ND Non Display
PC Position cursor ,UL Underline
Q.What is the difference between array and a multiple occurrence data structure?
A.The values stored in array don’t vary. In the other hand, we can store the different values in same
variables at various stages.
Q.How can you execute a command from within an RPG program without calling a CLP program?
A.By calling QCMDEXC application program interface we can execute a CL command with in an RPG
program.
Q.Which of the following operations does NOT zero the field FLDA defined as 4,0?
A.
C MOVE *ZEROS FLDA
C Z-ADD *ZEROS FLDA
C Z-ADD 0 FLDA
C MOVE *ALL'0' FLDA
C SUB FLDA FLDA
C MOVE '0000' FLDA
C CLEAR FLDA
C MOVE *BLANKS FLDA
The last instruction does NOT zero the field FLDA.
Q.How can you check for a records existence without causing and I/O (CHAIN/READ)?
A.With the help of File Information Data Structure, we can check existence of records in a physical file.
The code is described below:
In File description continuation line (IPFK),
KINFDS RCDS
IRCDS DS
I *RECORD #RCDS
with the above code we can check the existence of records in a file without causing I/O operation.
What is the difference between regular logical file and join logical file?
Ans:Regular logical file contains more than one record format.
Record format name in regular logical file should be same based on the physical file.
Join logical file contains only one record format.
Record format name in join logical file should be different.
Through logical file we can made changes in physical file.
Through join logical file we can't made changes in physical file.
What is the necessary keyword used in a physical file to refer field definitions from the field
reference file?
Ans:REF which is a file level keyword is necessary to define at file level in a physical file. The syntax is
as follows: REF(library name/name of the field reference file)
What are the different types of access paths maintained on the file?
Ans:
Immediate: All the access paths (open and close) associated with a file will be updated whenever
changes made to a file.
Rebuild- only open access paths will update whenever changes made to the file. Rebuild takes place
whenever remaining access paths will be open.
Delay : Rebuild will not takes place.
Q.How would you join 3 separate fields, a first name, middle initial and last name together as 1 field with proper
spacing?
A.You can describe in either RPG and/or RPG ILE (Integrated Language Environment)
MOVE 'Dr. ' FNAME 3
MOVE 'JOHN' MNAME 4
MOVE 'WATSON' LNAME 6
FNAME CAT MNAME: 1 VAR1 8
VAR1 CAT LNAME:1 VAR2 15
DSPLY VAR2
MOVE *ON *INLR
Q.When PGMA calls PGMB for the first time PGMB executes the *INZSR. PGMB uses the RETRN operation to return to
PGMA. When PGMA call PGMB the second time is the *INZSR executed?
A.If you specify RETRN in called program, the *INZSR will not execute again.
Q.Show 2 ways to convert a date from YYMMDD to MMDDYY (MULT operation not acceptable)
A.
CVTDAT DATE() RTNVAR( ) FROMFMT( ) TOFMT( )
Source code is required to convert from one date format to another date format.
The source code in CLP is given below:
PGM
DCL VAR(&VAR1) LENGTH(6) TYPE(*CHAR) VALUE('YYMMDD')
DCL VAR(&RCVD) LENGTH(6) TYPE(*CHAR)
DCL VAR(&VAR2) LENGTH(4) TYPE(*CHAR)
DCL VAR(&VAR3) LENGTH(2) TYPE(*CHAR)
CHGVAR VAR(&VAR2) VALUE(%SST(&VAR1 3 4))
CHGVAR VAR(&VAR3) VALUE(%SST(&VAR1 1 2))
CHGVAR VAR(&RCVD) VALUE(&VAR2 *CAT &VAR3)
SNDMSG MSG(&RCVD) TOUSR(*USRPRF)
ENDPGM
Q.Define Subsystem?
A.Subsystem is nothing but it provides specialized environment to complete the execution of jobs.
2.File information data structure :A file information data structure provides exception/error information that may be
occurred when processing a file during program execution. This type of data structure contains pre defined sub fields
that identify
a.The name of the file for which the error occurred
b.The record processed when the error occurred
c.The operation being processed when the error occurred
d.The status code number
e.The RPG/400 routine in which the error occurred.
Exception errors may be controlled by testing for an error code in the *STATUS field which is included in a file
information data structure. Specifically, keywords including *FILE, *RECORD, *OPCODE, *STATUS, *ROUTINE
provide the previously named information.
When will you use OPEN and CLOSE opcodes in RPG program?
Ans:If you specify the letter "U" at columns 73 - 74 in a file description specification indicating that user
control on a file. Hence we have to explicitly open and close the file in a program.
It is always good CLP programming approach to check the object before you
rename, delete the objects on the system.
BL Blinking field ,HI High Intensity ,RI Reverse Image ,CS Column separator ,ND Non Display
PC Position cursor ,UL Underline
Q.What is the difference between regular logical file and join logical file?
A.
1.Regular logical file contains more than one record format.
2.Record format name in regular logical file should be same based on the physical file.
3.Join logical file contains only one record format.
4.Record format name in join logical file should be different.
5.Through logical file we can made changes in physical file.
6.Through join logical file we can't made changes in physical file.
Q.What is the necessary keyword used in a physical file to refer field definitions from the field reference file?
A.REF which is a file level keyword is necessary to define at file level in a physical file. The syntax is as follows:
REF(library name/name of the field reference file)
Q.What are the different types of access paths maintained on the file?
A.
1.Immediate: All the access paths (open and close) associated with a file will be updated whenever changes made to
a file.
2.Rebuild- only open access paths will update whenever changes made to the file. Rebuild takes place whenever
remaining access paths will be open.
3.Delay : Rebuild will not takes place.
Q.What is the difference between externally described file and program described file?
A.The field definitions and descriptions are defined out side of the program in a externally described file. The field
definitions and descriptions are defined in side the program in a program described file.
Q.What is the maximum number of fields under a record format of physical file?
A.8000 (eight thousand)
Q.What are the necessary keywords for the Join Logical file?
A.JDFTVAL, JFILE, JOIN, JFLD, JREF.
Q.Can we have records (with fields from more than one file) from multiple files and Nested / sub
query in SQL ?
A.Yes, we can have record from multiple file with join condition and we also can have nested
query or subquery like SELECT * FROM FILE1 WHERE FILE1.FLD1 IN (SELECT
FILE2.FLD1 FROM FILE2)
2.RESTRICT –
a.Deleting a record in a parent file is permitted if data for a non-null parent key does not match
data for a foreign key.
b.Deleting a record in a parent file is restricted if data for a non-null parent key matches data for
a foreign key.
3.CASCADE –
The cascade delete rule is used. Deleting a record in a parent file causes matching records in the
dependent file to be deleted when data for a non-null parent key matches data for a foreign key.
2.RESTRICT –
a.Updating a record in a parent file is permitted if data for a non-null parent key does not match
data for a foreign key.
b.Updating a record in a parent file is restricted if data for a non-null parent key matches data for
a foreign key.
Q.What is the stored procedure and how do you define a stored procedure.
A.A stored procedure is a program that can be called to perform operations that can include both
host language statements and SQL statements. Procedures in SQL provide the same benefits as
procedures in a hot language. That is, a common piece of code need only be written and
maintained once and can be called from several programs. Stored procedures can be used in both
distributed and non-distributed applicaitons.It is defined using DECLARE PROCEDURE
statement, syntax is as below…
EXEC SQL
DELCARE P1 PROCEDURE
(:PARM1 INOUT CHAR(10))
(EXTERNAL NAME MYLIB/PROC1
LANGUAGE RPGLE
SIMPLE CALL WITH NULLS);
END-SQL
We can have parameters as IN , OUT , INOUT type. Language can be RPGLE, C, CL, etc..
MYLIB/PROC1 this PROC1 is a program written and compiled separately and it is of language
which you are specifying in section LANGUAGE.
Q.Writing an SQL statement from selecting records from TWO files using single statement and
Nested select statement.
A.
Using Single statement.
SELECT * FROM FILE1, FILE2
WHERE FILE1.FLD1 = FILE2.FLD1
Q.What is Procedure ?
A.A procedure is the set of self contained high level language statements that can perform a particular task and then
returns to a caller.
Q.If we tried to move year part of *ISO date into a field of length 3, what will happen ?
A.Program crashes, as in case of *ISO format it required fields of 4,2,2.
Q.What is OVERLAY?
A.It allows a record format to be displayed on screen retaining the previous displayed record formats.
Q.What are the disadvantage of using Validity Check keyword? How to overcome these disadvantages ?
A.
1.If invalid values are entered,
2.The option filed is displayed in reverse image.
3.System defined message is displayed which may not be user friendly.
4.Keyboard is locked, we have to reset it.
5.To overcome above disadvantage validations is done within program and user
Q.What is the values SQLCOD when there is an error in fetching the records specified in the select statement?
A.-ve value
Q.What is a Journal?
A.A Journal is an object used primarily to record changes to data in a PF.
Q.Which of the CL command can be used to determine which logical files are dependent on a specific file?
A.DSPDBR
Q.Which CL command can be used at program execution to redirect the file named in an RPG program?
A.OVRDBF
Q.What is the length of the variable in the given example? DCL VAR (&Name) TYPE (*Char)?
A.Default 32 & for Decimal 15,5
1 - 8 Character *FILE The first 8 characters of the file
9 - 9 Character Open indication (1 = open).
10 - 10 Character End of file (1 = end of file)
11 - 15 Zoned dec *STATUS Status code.
16 - 21 Character *OPCODE Operation code The first five posi
22 - 29 Character *ROUTINE First 8 characters of the procedure
30 - 37 Character RPG IV source listing line number
Q.How can see logical file based on which physical file and vice versa
A.DSPDBR
Q.What is procedure?
A.A procedure is the set of self-contained high level language statements that can perform a particular task and then
returns to a caller
Q.How will you add a field to physical file already containing data?
A.With CPYF command and *NOCHK & *DROP
Q.What are the uses of FACTOR1, FACTOR2 and RESULT field for the RPG operation code PARM?
A.It is add value of FACTOR1 to FACTOR2 or compare the value of FACTOR 2 with FACTOR1.
Q.How you will find an error which is not in the first page of the subfile without using ROLLDOWN key?
A.By using keyword SFLRCDNBR.
Q.What is SFLROLVAL?
A.By using this keyword you can tell system to roll on of records when the user presses ROLLDOWN key (For this you
define a hidden of 4 byte).
Q.How you will know whether you are in SFLDROP or SFLFOLD mode?
A.By using the keyword SFLMODE.
Q.How you get the relative record in a subfile in which cursor is located?
A.By using the keyword SFLCUSRRN (Subfile cursor relative record number).
Q.What is QCMDEXC?
A.It is used to execute a single CL command within the RPG program.
Q.What are the maximum parameters can be passed from one RPG program to another RPG program?
A.255
Q.How many maximum parameters can be passed from on RPG program to another CL program?
A.40
Q.How many maximum printer files can be used in a single RPG program?
A.8
Q.What is a subfile?
A.Subfile is a group of records which can be used for (Displaying, Adding new record, Modifying the existing record,
and Deleting the existing records).
Q.How do you write and read a value (similarly as EXFMT of RPG) using a display file in CL?
A. SNDRCVF.
Q.What is *PSSR?
A.It is a system subroutine which is executed by default when any error occurs in a program.
Q.You have given a job for printing and you are not getting the printout what might be the reason?
A.Some more pending jobs might be there in Job Queue.
Q.There are multiple jobs for printing in job queue and you want to print a important document then what will you
do?
A.Change the priority or change the job queue name.
Q. How many record formats can you have in a Physical file and in a Logical file ?
A.Physical file can contain only one record format, Logical file can contain more than one record format.
Q.What is the symbol used for copying & moving new field in SDA?
A.Copying : '-' & '=='.
Moving : '-' & '='.
Q.What is the symbol used to get name & length of a field in SDA?
A.'?' .
*DATE, *TIME.
Q.What is a trigger?
A.A trigger is an action that automatically occurs whenever a change Is made to a physical file.
Q.What is a table?
A.A table is collection of data elements in one column, data elements Must be of same type and same length.
Q.What is a Compile Time Table?
A.We can hard code data within the program is said to be Compile Time Table.
Q.If the data is likely to change over a period of time & Moreover data is large than which type of table is preferred?
A.Compile Time Table.
Q.What is an Array?
A.Array is a collection of data, the data elements must be of same Length and same type.
Q.The Qualified name for an object ORDPF residing in a library TRAINING is?
A.RAINING/ORDPF
Q.The function key to start SEU session through program development manager is?
A.F6
Q.The Member type for an RPG & CL program which SEU supports is?
A.RPG & CLP
Q.Change in the externally described file does not require recompilation of the program? (True/False)
A.False
Q.Command to display current library is?
A.DSPCURLIB
Q.Which one of the following has the highest priority Library on top of the library list, Library QGPL, Library on the
bottom of the library list & Current library?
A. Current library
Q.While designing the screen user wants to add file level keywords then which function key is pressed?
A.F14
Q.While designing the report using RLU user wants to add record level keywords which function key is pressed?
A.F18
Q.If user wants to add one field on the report then which function key is pressed?
A.F11
Q.If user wants to center the company name on his report then which command will be used?
A.CF (Center Field)
Q. Which function key should be pressed to define hidden field while you are working with SDA?
A.F4
Q.Which function key should be pressed to watch all string defined on SDA screen?
A.F20
Q.While designing the screen using SDA, which function key should be pressed to get the field from the FRF?
A.F10.
Q.From WRKMBRPDM screen you have to modify existing member-using SDA which option do you select?
A.17.
Q.Write system defined function used to place system name on the screen?
A.*SYSNAME
Q.While designing screen F3 function key is kept common for all record formats on which level should it be defined?
A.File level
Q.If user wants to change the length of the numeric field defined in the report then which combination of the keys
will be used?
A.F23 & F10
Q.What is the difference between SKIPB (2) & SPACEB (2)?
A.SKIPB (2) skips 1 page & on the next page after skipping 2 lines space print next while SPACEB (2) skips 2 lines
space before printing.
Q.RLU: If user wants to define new numeric field on record format then which line command will be used?
A.VF
Q.To change constant field defined on RLU screen which field level keyword should be used?
A.DFT (Default)s
Q.Which Function key should be pressed to define hidden field while you are working with
SDA?
A.F4
Q.Which function key should be pressed to watch all strings defined on the SDA screen?
A.F20
Q.While designing the screen using SDA, which function key should be pressed to get the field
from the field reference file?
A.F10
Q.From work with member using PDM screen you have to modify existing member using SDA,
which option do you select?
A.17
Q.While designing the screen, F3 function key is kept common for all record formats. On which
level should it be defined?
A.File Level
Q.While designing the screen user wants to add file level keywords, then which function key
should be pressed?
A.F14.
Q.While designing the report using RLU, user wants to add record level keyword then which
function key should be pressed?
A.F18.
Q.If user wants to add one field on the report then which function key should be pressed?
A.F11.
Q.If user wants to center the company name on his report then which line command will be
used?
A.CF.
Q.If user wants to change the length of the numeric field defined in report then which
combination of keys will be used?
A.F23 & F10.
Q.RLU: If user wants to define new numeric field on record format then which line command
will be used?
A.VF.
Q.To change constant field defined on RLU screen which field level keyword should be used?
A.DFT
Q.RLU: Which field level keyword should be used to change any numeric field of length 8 to
99.99.9999 format?
A.EDTWRD (‘ . . ‘)
Q.What is the difference between normal UPDDTA to PF and updating using DFU program?
A.Both are same only difference is DFU allows you to add or change selected fields.
Q.What is Library?
A.A library is a system object that serves as a directory to other objects or collection of object
Q.What is the object type of PF, LF, Printer file & Display file?
A.*File
Q.At what level S,O are defined and what they will do?
A.S, O are to defined at key field level. The purpose Select/Omit logic is depends on the criteria
(condition) given at the key field level (At function entry) it selects and omits the records. The
S/O is allowed in Logical file only.
Q.What is default data type (if you define decimals '0') in Physical file?
A.Packed decimal
Q.What is default data type for the fields(sub fields) defined in data structures in RPG?
A.Zoned decimal
Q.What is the maximum number of key fields allowed defining in a physical file?
A.s120
Mainframe AS-400 Interview Questions Part 14
Q.How many types of display are available on As/400 for user interaction?
A.The 4 Types they are Entry, Menu, Information & List Display.
Q.How many Specs are there in RPG & Which are they?
A.There are 7 Specs in RPG they are H, F, E, L, I, C & O.
Q.How many printer files maximum can be used in single RPG program?
A.8 because of the overflow indicators OA-OG & OV.
Q.When you are defining a flat file in your program in F Specs which format will you specify?
A.Flat File: - F (Fixed Length) Other File: - E (Externally Described)
Q.What is CAB?
A.It compares Factor1 with Factor2 & if condition is true, control is transferred to label designated in the result
field. The label specified must appear as the Factor1 of a TAG operation somewhere in the program.
Q.To add a file to the ‘File Selection’ option of a Query, the function key to be pressed is?
A.F9