AS/400, AS400 Interview Questions and Answers
AS400 questions in companies like IBM, CTS, Infosys.Which of the following operations does NOT zero the field FLDA defined as 4,0?
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.
How would you design the process for a nightly, high volume check producing process that needs to select only records that are flagged to be processed?
Answer : With the help of OPNQRYF Clp command, we can select the records from the data base file. The process involves following steps:
Steps: 1. OVRDBF with SHARE (*YES)
3. CALL the program
How would you join 3 separate fields, a first name, middle initial and last name together as 1 field with proper spacing? 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
MOVE *ON *INLR
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?
Answer : If you specify RETRN in called program, the *INZSR will not execute again.
Show 2 ways to convert a date from YYMMDD to MMDDYY (MULT operation not acceptable)
1) 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:
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)
Define the purpose of Factor 1 the Operation Code and *IN15 in following code
HI LO EQ
C *YMD Test(D) yymmddDate 15
Ans : If the factor 1 value matches with factor2 value, the indicator specified in EQ comes *ON.
Describe the function of SETLL operation in RPG language?
Answer : The SETLL operation positions a file at the next record with a key or relative record number that is greater than or equal to key or relative record number specified in factor1.
Describe the function of SETGT operation in RPG language?
Answer : The SETGT operation positions a file at the next record with a key or relative record number that is greater than key or relative record number specified in factor 1.
What is the purpose of Level Check parameter in a Physical file?
Answer : Specifies whether the level identifiers of the record formats in the physical file are checked when the file is opened by the program.
Define a Job Queue?
Answer : Job queues are queues of batch jobs waiting to be processed.
Define a Output Queue?
Answer : Output queues are queues of jobs waiting to be printed.
What is the function of CPYSPLF command?
Answer : It copies the spooled file to the data base file.
What is the function of CPYF command?
Answer : To copy the data from the one file to another.
What is the function of CRTDUPOBJ command?
Answer : To create the replica from the original object.
Answer : Subsystem is nothing but it provides specialized environment to complete the execution of jobs.
What are different types of Substems?
Answer : QBATCH, QINTER, QSPL, QCMN, QCTL, QBASE.
Define a Batch Job?
Answer : * A user request the job.
* The job is created (job name is assigned, job attributes are allocated)
* The job is placed on a job queue
* The sub system QBATCH takes the job from job queue and starts it.
* Output generated by the batch job is placed on an output queue.
* The spool sub system prints the output on the output queue.
Describe about Query/400?
Answer : Query/400 is a licensed program that uses a query to analyze and select the information contained in the data base files and create a query report.
A query report can be:
* displayed on a workstation (screen)
* stored in another database file.
What is the CLP command to access a Query/400?
Answer : WRKQRY
What is the purpose of Overrides?
Answer : The basic purpose of Overrides is to temporarily change the attributes of a file. So you don't have to create permanent files for every combination of attributes your application might need. Overrides gives you the flexibility to use existing model files and dynamically change their attributes.
Define Data Structure?
Answer : Data structures are specified in the Input specifications of an RPG/400 program to define an area in storage and layouts of related sub fields.
What is the purpose of Data structure?
* Divide a field in to sub fields
* Change the format of a field
* Group non-contiguous data in a contiguous format
* Define an area of storage in more than one format
* Define Multiple occurrences of data structures.
List and explain the different type of data structures?
Answer : * Data area data structureWhen the data area is defined in an RPG/400 program as a data area data structure, its data is implicitly retrieved for processing and written back at the end of the program. In the data area data structure, letter "U" must be entered to define the data structure as a data area data structure.
* 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
* The name of the file for which the error occurred
* The record processed when the error occurred
* The operation being processed when the error occurred
* The status code number
* 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.
* Program status data structure
Program status data structure however identity exception/errors that are generated in the program by RPG/400 operations and not by a file. Note that any code greater than 00099 is flagged as an exception/error. Four keywords - *STATUS, *ROUTINE, *PROGRAM, *PARMS are supported by a program status data structure.
What is the purpose of DYNSLT keyword?
Answer : This is a file level keyword used in a logical file. If you specify this in a file level, the system doesn't perform record selection until the program reads file. Then on the Select/Omit criteria, it selects the records from the specified file.
When would you prefer logical file than OPNQRYF?
Answer : The physical file you are working with very large, creating and using a logical file will allow an application to perform faster than using an open query file. Since access paths created by open query files are temporary, applications that use an access path frequently will be more efficient using a logical file, since the access path will not have to be rebuilt every time the file is open.