Category Archives: Interview Questions And Answers

top AS/400 Interview Questions Answers

AS/400 Interview Questions Answers-section 12

Which are the four keywords supported by Program Status Data Structure?
Ans:*STATUS, *PARM, *ROUTINE & *PROGRAM

Which are the String Manipulation Opcodes?
Ans:TESTN, SCAN, CHECK, CHECKR, SUBST & CAT

DB2 is a type of Database?
Ans:It is an Integrated RDBMS.

An access path may be in which sequence?
Ans:It can be in Arrival & Keyed sequence

To change constant field defined on RLU screen which field level keyword should be used?
Ans:DFT (Default)

Space & Skip are which level keywords?
Ans:Field & Record

A Join Logical File has how many Record formats?
Ans:1

A Multiple format Logical File is also known as?
Ans:Union File

How does Union file maintains Record formats?
Ans:1 Record format for each PF

Records can be Read/Update/Deleted with which file?
Ans:Simple Logical File & Physical File.

Which type of object is used in DB2/400?
Ans:*FILE

What is SQL?
Ans:SQL is an interface for programming language.

File level entry for a PF can be?
Ans:UNIQUE & FIFO

What is the command to create FRF?
Ans:CRTPF

Join Logical File displays data from how many files?
2 or more PF’s

A Query can be displayed without saving it?
Ans:True

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

A query can be run in which mode?
Ans:Batch & Interactive

What is the values SQLCOD when there is an error in fetching the records specified in the select statement?
Ans:-ve value

A file cannot have more than 1 unique key?
Ans:False

DLCOBJ command is mandatory for removing lock on any object?
Ans:False

What is a Journal?
Ans:A Journal is an object used primarily to record changes to data in a PF.

Which are the DB2 tools to protect Integrity of the database?
Ans:Journaling & Commitment Control, Referential Integrity Embedded SQL & Object/Record Locks.

 

What are the three types of keywords associated with printer file ?
Ans:File level, Record level & Field level.

Difference between SFLRCDNBR and SFLNXTCHG
Ans:SFLRCDNBR will give the RRN of the First record displayed on the screen at a given time.
Whenever a record is changed on display file. An MDT is set ON. If an indicator is associated with SLFNXTCHG and it is SETON then READC will read only the changed record. And if the indicator is not associated and it is seton it READC reads all the records from sub-file

How can see logical file based on which physical file and vice versa
Ans:DSPDBR

How can u check no of records in a file
Ans:DSPFD

How do u compile RPGLE program
Ans:Either thru 15 or crtrpgmod

Is module executable
Ans:No You need to create an RPG prog to run the module.

How do you combine two record formats in RLU ?
Ans:Using CLC.
19.

What are the different commands used in RLU ?
Ans:DR – Define Record, CLC – Change Line for Continuation, CLR – Change Line for Record, SD – Create Sample Data, VF – View Fields, NP – New Page, DC – Define Constants, DF – Define Fields, CF – Centre Fields & SP – Space Fields evenly.

What is the command used to invoke RLU ?
Ans:STRRLU.

What are different record spacing keywords in RLU ?
Ans:SKIPA, SKIPB, SPACEA & SPACEB.

Mandatory keywords of sub file
Ans:SFL, SFLCTL, SFLDSP, SFLSIZ, SFLPAG are the mandatory key words

What is procedure?
Ans:A procedure is the set of self-contained high level language statements that can perform a particular task and then returns to a caller

What is service program?
Ans:
A Service Program is a collection of runnable procedures and available data items easily accessible by other ILE programs. In many respects it is similar to a subroutine library and procedure library.
A service program differs from a program in two ways:
It does not contain a program entry procedure. This means that you cannot call a service program using the CALL operation.
A service program is bound into a program or other service programs using binding by reference
What is LOKUP opcode?
Ans:Look’s for a particular element of an array

How many files, printer files you can describe in a RPG
Ans:50 files and 8 printers

How do handle file exception/error
Ans:*INFDS ,*PSSR defining it in F spec

Distinguish between terminating a program through SETON LR and RETURN?
Ans:LR closes all the files used in the program and RETURN is used to return the control to the parent program.

How will you add a field to physical file already containing data?
Ans:With CPYF command and *NOCHK & *DROP

What are the uses of FACTOR1, FACTOR2 and RESULT field for the RPG operation code PARM?
Ans:It is add value of FACTOR1 to FACTOR2 or compare the value of FACTOR 2 with FACTOR1.

How will you find a string using PDM?
Ans:By using FNDSTRPDM.

How will you search an array?
Ans:LOKUP

What are the different types of arrays?
Ans:Preruntime gets populated at the time input. Runtime gets populated at the time execution.Compile time gets populated at the time of compilation.

What is message file?
Ans:It is file which contain messages created by the user through which a user can display own message while validating.

What does DEFN do?
Ans:It is used to define a field based on the value specified in FACTOR 1.

What are two types of record are used in subfile?
Ans:SUBFILE RECORD FORMAT and SUBFILE CONTROL RECORD FORMAT.

What are DDS required for SUBFILE?
Ans:SUBFILE DISPLAY (SFLDSP) SUBFILE DISPLAY CONTROL (SFLDSPCTL) SUBFILE CLEAR (SFLCLR) SUBFILE SIZE (SFLSIZE) SUBFILE PAGE (SFLPAGE).

What is ELASTIC and NON ELASTIC SUBRILE?
Ans:When subfile size is greater then subfile page size it is called elastic subfile and when subfile size is equal to subfile page size it is called non-elastic subfile.

What is SFLINZ and SFLRNA?
Ans:SFLINZ stands for subfile initialize. It initialized all the character field as blanks and numeric fields as zeros. SFLRNA stands for subfile record not active (It means records are there in the subfile but active).

Can you display a empty subfile?
Ans:Yes by using the keyword SFLINZ and SFLRNA.

Why do we use READC? What is SFLNXTCHG?
Ans:READC is to read those records which have changed in the subfile. If you validate a record in subfile on some condition all the invalid records can display in reverse image. The first which have changed and made valid and released still displaying in reverse image. The records have read even it has not been changed due to SFLNXTCHG.

How do you read changed records backward in subfile?
Ans:NOT POSSIBLE.

How you will find an error which is not in the first page of the subfile without using ROLLDOWN key?
Ans:By using keyword SFLRCDNBR.

What is SFLROLVAL?
Ans: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).

How you will know whether you are in SFLDROP or SFLFOLD mode?
Ans:By using the keyword SFLMODE.

How you get the relative record in a subfile in which cursor is located?
Ans:By using the keyword SFLCUSRRN (Subfile cursor relative record number).

What is QCMDEXC?
Ans:It is used to execute a single CL command within the RPG program.

What is OPNQRYF, MONMSG commands
Ans:
It is Dynamically creation of access path, and it can have resultant fields i.e. if the expression is A = B + C then B and C are from the file while A is defined in OPNQRYF. We can divert the output of command to an OUTFILE. Command associated with OPNQRYF is CPYFRMQRYF to save the output permanently

It is a CL command to monitor and error/exception message so that in case of an error a dump is avoided and the control is in program. It is also used to monitor user message.

 

***************************

AS/400 Interview Questions Answers-section 13

 

What are the different Opcodes available in RPG for Database access ?
Ans:READ, CHAIN, WRITE, UPDAT, DELET, SETLL, SETGT, READE, READP, REDPE, OPEN, CLOSE, FORCE, NEXT, UNLCK.

How can database records be read without lock ?
Ans:Put ‘N’ in position 53 of C specs.

What does CHECK opcode do ?
Ans:The check operation verifies that each character in the base string (factor 2) is among the ` character indicated in the comparator string(factor 1).

In conjunction with which statements can ORxx and ANDxx conditions be used ?
Ans:DOUxx, DOWxx, IFxx, and WHxx.

What does opcode POST do ?
Ans:Puts information in INFDS.

Can you have multiple key lists for a single file ?
Yes.

What are the different types of arrays available in RPG ?
Ans:Pre-execution time array.
Compile time array.
Execution time array.

Can we define Multi-dimensional arrays in RPG ?
Ans:No.

What is XFOOT opcode ?
Ans:Adds all the elements in a numeric array, and places the sum in the result field.

During input operation which indicator position is seton if there is a record lock?
Ans:LO indicator position is seton.

What is the difference between *LIKE and *NAMVAR ?
Ans:
*LIKE defines the variables as in database.
*NAMVAR is used to define variables as data area.

What would be the effect on the field where reverse image, underline and highlight display attributes are active ?
Ans:The result is same as if you had specified ND.

What is the purpose of OVRDTA and OVRATA keywords ?
Ans:OVRDTA keyword (field or record level) can be used to override the existing data contents of a field or record already on the display.
OVRATA keyword (field or record level) can be used to override the existing display attributes of a field or record already on the display.

What keyword must be used with PROTECT keyword ?
Ans:OVERLAY

What is RPG ?
Ans:Report Program Generator.

Where will control be passed after the execution of the *PSSR subroutine if the factor2 of the ENDSR is blank ?
Ans:Control will return to the next sequential instruction.

What is the maximum number of subfiles that can specified in a display file ?
Ans:512

The maximum number of subfiles that can defined in a RPG program for one display file is ___ .
Ans:24

The maximum number of subfiles that can be active for a single file is ____ .
Ans:12

What are the different opcodes used for file operation on a subfile in a RPG pgm?
Ans:READ, READC, CHAIN,UPDAT and WRITE

How will you display a particular page in subfile ?
Ans:Move a valid relative record number(RRN) in the field specified using SFLRCDNBR keyword in DDS.

Can a single screen format occupy a screen area above and below a subfile format ?
Ans:Not possible.

What is SFLPAG and SFLSIZ ?
Ans:
SFLPAG : it is an attribute which specifies the number of records that can be displayed in a screen.
SFLSIZ : it is an attribute which specifies the number of records can be stored in the subfile.

How to pick up the changed records every time in a subfile after the first change made ?
Ans:Seton SFLNXTCHG keyword indicator and update the subfile record.

How do you specify the number of records to roll in a subfile ?
Ans:Use SFLROLVAL keyword in DDS along with the number, which specifies the number of records to scroll at a time.

What are the three line types in RLU ?
Ans:Report line, Filler line & Sample line.

What is the function of RLU ?
Ans:To design & prototype a report.

 

What is a library in AS/400 ?
Ans:Library in AS/400 is an object that serves as a repository for other objects.

Name few IBM supplied libraries ?
Ans:GPL, QTEMP, QUSRTOOL, QSYS, QRPG & QCBL.

What is a library list ?
Ans:Library list that indicates libraries used for the process and the order in which it has to be
searched. System identifies it in *LIBL.

How many libraries can be there in a library list ?
Ans:Total 40 (15 system and 25 application).
DDS – Data Description Specification.
Source Physical File contains the source for the various objects created. This file has a specific structure.
RPG, CLP, DSPF, PRTF, etc.
A-spec
UNIQUE, PFILE, REFFLD

What is the difference between Physical and Logical files ?
Ans:Physical file contains data, where as Logical file serves as a access path to database.

What does the keyword UNIQUE mean ?
Ans:Records with duplicate key values are not allowed.

What is FCFO, FIFO, LIFO in Database environment ?
Ans:These are file level keywords which are used to access the records in the order
FCFO : First Changed First Out
FIFO : First In First Out
LIFO : Last In Fist Out

How many record formats can you have in a Physical file and in a Logical file ?
Ans:Physical file can contain only one record format, Logical file can contain more than one record format.

What is Multi-format logical file ?
Ans:Logical which uses fields from two or more physical files.

What is keyword PFILE specifies ?
Ans:PFILE is used define the Physical file being referenced.

What is a Join Logical File, Can it be used for Update ?
Ans:Logical file that combines more than one physical file.
Update is not possible through JLF.

Is it possible to join the same file to itself ?
Ans:Yes.

What does SDA stands for ?
Ans:Screen Design Aid.

What is the symbol used for defining a new field in SDA?
Ans:’+’.

What is the symbol used for shifting fields in SDA?
Ans:'<‘ , ‘>’.

What is the symbol used for copying & moving new field in SDA?
Ans:
Copying : ‘-‘ & ‘==’.
Moving : ‘-‘ & ‘=’.

What is the symbol used to get name & length of a field in SDA?
Ans:’?’ .
*DATE, *TIME.

How can a screen field that has changed since the last output operation be detected ?
Ans:Attach the MDT attribute to the field, to detect whether field has been changed as a result of user input.

What are the different types of specification available in RPG/400 ?
Ans:
Control Spec.( H )
File Spec.( F )
Extension Spec.( E )
Line counter Spec.( L )
Input Spec.( I )
Calculation Spec.( C )
Output Spec.( O )

Is it necessary to define all formats ? Which are mandatory and which are Optional ?
Ans:No, all are Optional.

What is the use of E specification in RPG ?
Ans:Extension Specs describes all record address files, arrays and tables.

In which specification can a report layout be defined ?
Ans:O Specification.

How many files can be defined in F specs ?
Ans:A maximum of 50 files.

Can an indexed file be accessed in arrival seQuence in RPG program ?
Ans:Yes.

In which specification Data Structures can be defined?
Ans:I – Spec.

When is a TAG statement used in RPG ?
Ans:It is used as a Label.

 

AS/400 Interview Question Answers

AS/400 Interview Questions Answers-section 10

 

Which are the four keywords supported by Program Status Data Structure?
Ans:*STATUS, *PARM, *ROUTINE & *PROGRAM

Which are the String Manipulation Opcodes?
Ans:TESTN, SCAN, CHECK, CHECKR, SUBST & CAT

DB2 is a type of Database?
Ans:It is an Integrated RDBMS.

An access path may be in which sequence?
Ans:It can be in Arrival & Keyed sequence

To change constant field defined on RLU screen which field level keyword should be used?
Ans:DFT (Default)

Space & Skip are which level keywords?
Ans:Field & Record

A Join Logical File has how many Record formats?
Ans:1

A Multiple format Logical File is also known as?
Ans:Union File

How does Union file maintains Record formats?
Ans:1 Record format for each PF

Records can be Read/Update/Deleted with which file?
Ans:Simple Logical File & Physical File.

Which type of object is used in DB2/400?
Ans:*FILE

What is SQL?
Ans:SQL is an interface for programming language.

File level entry for a PF can be?
Ans:UNIQUE & FIFO

What is the command to create FRF?
Ans:CRTPF

Join Logical File displays data from how many files?
2 or more PF’s

A Query can be displayed without saving it?
Ans:True

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

A query can be run in which mode?
Ans:Batch & Interactive

What is the values SQLCOD when there is an error in fetching the records specified in the select statement?
Ans:-ve value

A file cannot have more than 1 unique key?
Ans:False

DLCOBJ command is mandatory for removing lock on any object?
Ans:False

What is a Journal?
Ans:A Journal is an object used primarily to record changes to data in a PF.

Which are the DB2 tools to protect Integrity of the database?
Ans:Journaling & Commitment Control, Referential Integrity Embedded SQL & Object/Record Locks.

 

What are the three types of keywords associated with printer file ?
Ans:File level, Record level & Field level.

Difference between SFLRCDNBR and SFLNXTCHG
Ans:SFLRCDNBR will give the RRN of the First record displayed on the screen at a given time.
Whenever a record is changed on display file. An MDT is set ON. If an indicator is associated with SLFNXTCHG and it is SETON then READC will read only the changed record. And if the indicator is not associated and it is seton it READC reads all the records from sub-file

How can see logical file based on which physical file and vice versa
Ans:DSPDBR

How can u check no of records in a file
Ans:DSPFD

How do u compile RPGLE program
Ans:Either thru 15 or crtrpgmod

Is module executable
Ans:No You need to create an RPG prog to run the module.

How do you combine two record formats in RLU ?
Ans:Using CLC.
19.

What are the different commands used in RLU ?
Ans:DR – Define Record, CLC – Change Line for Continuation, CLR – Change Line for Record, SD – Create Sample Data, VF – View Fields, NP – New Page, DC – Define Constants, DF – Define Fields, CF – Centre Fields & SP – Space Fields evenly.

What is the command used to invoke RLU ?
Ans:STRRLU.

What are different record spacing keywords in RLU ?
Ans:SKIPA, SKIPB, SPACEA & SPACEB.

Mandatory keywords of sub file
Ans:SFL, SFLCTL, SFLDSP, SFLSIZ, SFLPAG are the mandatory key words

What is procedure?
Ans:A procedure is the set of self-contained high level language statements that can perform a particular task and then returns to a caller

What is service program?
Ans:
A Service Program is a collection of runnable procedures and available data items easily accessible by other ILE programs. In many respects it is similar to a subroutine library and procedure library.
A service program differs from a program in two ways:
It does not contain a program entry procedure. This means that you cannot call a service program using the CALL operation.
A service program is bound into a program or other service programs using binding by reference
What is LOKUP opcode?
Ans:Look’s for a particular element of an array

How many files, printer files you can describe in a RPG
Ans:50 files and 8 printers

How do handle file exception/error
Ans:*INFDS ,*PSSR defining it in F spec

Distinguish between terminating a program through SETON LR and RETURN?
Ans:LR closes all the files used in the program and RETURN is used to return the control to the parent program.

How will you add a field to physical file already containing data?
Ans:With CPYF command and *NOCHK & *DROP

What are the uses of FACTOR1, FACTOR2 and RESULT field for the RPG operation code PARM?
Ans:It is add value of FACTOR1 to FACTOR2 or compare the value of FACTOR 2 with FACTOR1.

How will you find a string using PDM?
Ans:By using FNDSTRPDM.

How will you search an array?
Ans:LOKUP

What are the different types of arrays?
Ans:Preruntime gets populated at the time input. Runtime gets populated at the time execution.Compile time gets populated at the time of compilation.

What is message file?
Ans:It is file which contain messages created by the user through which a user can display own message while validating.

What does DEFN do?
Ans:It is used to define a field based on the value specified in FACTOR 1.

What are two types of record are used in subfile?
Ans:SUBFILE RECORD FORMAT and SUBFILE CONTROL RECORD FORMAT.

What are DDS required for SUBFILE?
Ans:SUBFILE DISPLAY (SFLDSP) SUBFILE DISPLAY CONTROL (SFLDSPCTL) SUBFILE CLEAR (SFLCLR) SUBFILE SIZE (SFLSIZE) SUBFILE PAGE (SFLPAGE).

What is ELASTIC and NON ELASTIC SUBRILE?
Ans:When subfile size is greater then subfile page size it is called elastic subfile and when subfile size is equal to subfile page size it is called non-elastic subfile.

What is SFLINZ and SFLRNA?
Ans:SFLINZ stands for subfile initialize. It initialized all the character field as blanks and numeric fields as zeros. SFLRNA stands for subfile record not active (It means records are there in the subfile but active).

Can you display a empty subfile?
Ans:Yes by using the keyword SFLINZ and SFLRNA.

Why do we use READC? What is SFLNXTCHG?
Ans:READC is to read those records which have changed in the subfile. If you validate a record in subfile on some condition all the invalid records can display in reverse image. The first which have changed and made valid and released still displaying in reverse image. The records have read even it has not been changed due to SFLNXTCHG.

How do you read changed records backward in subfile?
Ans:NOT POSSIBLE.

How you will find an error which is not in the first page of the subfile without using ROLLDOWN key?
Ans:By using keyword SFLRCDNBR.

What is SFLROLVAL?
Ans: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).

How you will know whether you are in SFLDROP or SFLFOLD mode?
Ans:By using the keyword SFLMODE.

How you get the relative record in a subfile in which cursor is located?
Ans:By using the keyword SFLCUSRRN (Subfile cursor relative record number).

What is QCMDEXC?
Ans:It is used to execute a single CL command within the RPG program.

What is OPNQRYF, MONMSG commands
Ans:
It is Dynamically creation of access path, and it can have resultant fields i.e. if the expression is A = B + C then B and C are from the file while A is defined in OPNQRYF. We can divert the output of command to an OUTFILE. Command associated with OPNQRYF is CPYFRMQRYF to save the output permanently

It is a CL command to monitor and error/exception message so that in case of an error a dump is avoided and the control is in program. It is also used to monitor user message.

 

*******************

AS/400 Interview Questions Answers-section 11

 

What are the different Opcodes available in RPG for Database access ?
Ans:READ, CHAIN, WRITE, UPDAT, DELET, SETLL, SETGT, READE, READP, REDPE, OPEN, CLOSE, FORCE, NEXT, UNLCK.

How can database records be read without lock ?
Ans:Put ‘N’ in position 53 of C specs.

What does CHECK opcode do ?
Ans:The check operation verifies that each character in the base string (factor 2) is among the ` character indicated in the comparator string(factor 1).

In conjunction with which statements can ORxx and ANDxx conditions be used ?
Ans:DOUxx, DOWxx, IFxx, and WHxx.

What does opcode POST do ?
Ans:Puts information in INFDS.

Can you have multiple key lists for a single file ?
Yes.

What are the different types of arrays available in RPG ?
Ans:Pre-execution time array.
Compile time array.
Execution time array.

Can we define Multi-dimensional arrays in RPG ?
Ans:No.

What is XFOOT opcode ?
Ans:Adds all the elements in a numeric array, and places the sum in the result field.

During input operation which indicator position is seton if there is a record lock?
Ans:LO indicator position is seton.

What is the difference between *LIKE and *NAMVAR ?
Ans:
*LIKE defines the variables as in database.
*NAMVAR is used to define variables as data area.

What would be the effect on the field where reverse image, underline and highlight display attributes are active ?
Ans:The result is same as if you had specified ND.

What is the purpose of OVRDTA and OVRATA keywords ?
Ans:OVRDTA keyword (field or record level) can be used to override the existing data contents of a field or record already on the display.
OVRATA keyword (field or record level) can be used to override the existing display attributes of a field or record already on the display.

What keyword must be used with PROTECT keyword ?
Ans:OVERLAY

What is RPG ?
Ans:Report Program Generator.

Where will control be passed after the execution of the *PSSR subroutine if the factor2 of the ENDSR is blank ?
Ans:Control will return to the next sequential instruction.

What is the maximum number of subfiles that can specified in a display file ?
Ans:512

The maximum number of subfiles that can defined in a RPG program for one display file is ___ .
Ans:24

The maximum number of subfiles that can be active for a single file is ____ .
Ans:12

What are the different opcodes used for file operation on a subfile in a RPG pgm?
Ans:READ, READC, CHAIN,UPDAT and WRITE

How will you display a particular page in subfile ?
Ans:Move a valid relative record number(RRN) in the field specified using SFLRCDNBR keyword in DDS.

Can a single screen format occupy a screen area above and below a subfile format ?
Ans:Not possible.

What is SFLPAG and SFLSIZ ?
Ans:
SFLPAG : it is an attribute which specifies the number of records that can be displayed in a screen.
SFLSIZ : it is an attribute which specifies the number of records can be stored in the subfile.

How to pick up the changed records every time in a subfile after the first change made ?
Ans:Seton SFLNXTCHG keyword indicator and update the subfile record.

How do you specify the number of records to roll in a subfile ?
Ans:Use SFLROLVAL keyword in DDS along with the number, which specifies the number of records to scroll at a time.

What are the three line types in RLU ?
Ans:Report line, Filler line & Sample line.

What is the function of RLU ?
Ans:To design & prototype a report.

 

A program variable coded in an Embedded SQL statement is referred to as?
Ans:Host Variable

Which of the CL command can be used to determine which logical files are dependent on a specific file?
Ans:DSPDBR

What does DFU program you to do on a record?
Ans:Insert, Update Delete & File Enquiry.

When are the Unique Constraints executed?
Ans:During Insert.

When are the Referential Constraints executed?
Ans:Insert, Update & Delete.

How many triggers can be associated with a file?
Ans:6(Maximum)

Why is the Declare cursor statement is used for?
Ans:To define & name the cursor & specify rows to be fetched.

What do we can do with the Embedded SQL statements?
Ans:We can Insert/Update/Delete records, fetch records, fetch values from records into variables.

Which CL command is used to trap error messages during program execution?
Ans:MONMSG

Which CL command can be used at program execution to redirect the file named in an RPG program?
Ans:OVRDBF

What is the length of the variable in the given example?
Ans:DCL VAR (&Name) TYPE (*Char)? Default 32 & for Decimal 15,5
We can determine weather a record is in use bye another user with the help of status code (*STATUS). If
*STATUS = 01218 i.e. record already locked.

How to write *PSSR ?
Ans:It just similar to any other subroutine.
*PSSR BEGSR
………………
………………
…………….
ENDSR

What is Procedure ?
Ans:A procedure is the set of self contained high level language statements that can perform a particular task and then returns to a caller.

What is Procedure Prototype and Procedure Interface.
Ans:
Procedure Prototype
In this section we specify the name of the procedure along with PR.
D PROC1 PR
Procedure Interface
It is section where we define all the parameter which are receiving or returning some values.
D PROC1 PI 5 0
D PARMA 5 0
D PARMB 5 0

How to define a procedure ?
Ans:
First we have define Procedure Prototype along with all parameter. And PR.
D PROC1 PR
Then define Procedure with Begin/End
Procedure Name Begin/End
P PROC1 B Export
Then define Procedure Interface along with parameter and PI
D PROC1 PI 5 0
D PARMA 5 0
D PARMB 5 0
Define all the parameters as a variable to the procedure
D PARMA S 5 0
D PARMB S 5 0
In not returnable procedure, the procedure should end with
C PROC1 E
In returnable procedure, it should end with
C RETURN PARMA + PARMB

 

AS/400 Interview Questions for exp

AS/400 Interview Questions Answers-section 8

 

How do you pass parameters in CL?
Ans:Using PARM keyword.

What are the valid user defined data area types?
Ans:CHAR, NUMERIC and LOGICAL

What is Multi-format logical file?
Ans:Logical which uses fields from two or more physical files.

What is the Select and Omit criteria in logical file?
Ans:This is used to specify rules for the Selection/Omission of records from a Physical File.

Can fields be concatenated INa logical file level?
Ans:Yes. by using CONCAT keyword

When would the ALL keyword be used?
Ans:Use with Select or Omit, to select/omit records.

What are the different types of keywords in display files?
Ans:File level, Record format level, Field level

What is difference between CAT, TCAT, BCAT?
Ans:
CAT – Concatenate two variables or constants into one continuous string.
BCAT – Truncates all trailing blanks in the first character string, one blank is inserted, then the two character strings
are concatenated.
TCAT – Truncates all trailing blanks in the first character string, the two character strings
are concatenated.

What are the different types of messages in CL?
Ans:Immediate message, Break message, Program message, User message

How to trap errors in CL?
Ans:By using Monitor Message Command (MONMSG)

What is the maximum length of a variable name in CL?
Ans:Maximum 11 characters (including ‘&’)

What are the limitations of CL (compare to RPG) ?
Ans:You can not use CL program to ADD or UPDATE records in database files.
Use Printer or ICF files.
Use Program described files.
Use the concept of subfile (to display more than one record), but a single output message subfile is a special type of
subfile that is supported well in CL.
Use subroutines.
You cannot declare more than one object (file) in a CL programme.

What is the use of Header Specification in RPG/400?
Ans:It identifies by H in column 6, provides informaion about generating and running programs.

When will DUMP and DEBUG opcodes be ignored?
Ans:If blank is specified in position 15 of H specs.

Specify different indicators used in RPG?
Ans:Overflow indicators
Record Identifying Indicators
Field Indicators
Resulting Indicators
Control Level Indicators

What are Control level indicators?
Ans:L1 to L9 used to identify certain fields on control fields and then used to condition which operations are to be processed at detail or total calculation or output time.

What is the use of E specification in RPG?
Ans:Extension Specs describes all record address files, arrays and tables.

What is the use of L specs in RPG?
Ans:Line counter specification can be used to describe printer file to indicate the length of the form and number of lines per page.

In which specification the report layout can be defined?
Ans:O Specification.

How many files can be defined in F specs?
Ans:50

How many printer files can be defined in F specs ?
Ans:8

What is the maximum number of records you can specify in a display file?
Ans:1024

How can a screen field that has changed since the last output operation be detected ?
Ans:Attach the MDT (modified data tag) attribute to the field, to detect whether field has been changed as a result of user input.

What would be the effect on the field where reverse image, underline and highlight display attributes were active?
Ans:The result is same as if you had specified ND.

What is the use of DSPATR(MDT) keyword?
Ans:Sets on the modified Data Tag of the field. The Data Tag detect whether the field has been changed as a result of user input.

If DSPATR(PC) and CSRLOC were specified for a format, which keyword would have priority?
Ans:CSRLOC gains priority.

Can error messages as a result of a COMP, RANGE or VALUES keyword be overridden?
Ans:Yes, through CHKMSGID keyword.

What the purpose of OVRDTA, OVRATA keywords?
Ans:OVRDTA keyword (field or record level) can be used to override the existing data contents of a field or record already on the display.
OVRATA keyword (field or record level) can be used to override the existing display attributes of a field or record already on the display.

How can a message from a message file appear as a constant on the screen?
Ans:By using MSGCON (message constant) keyword.

In conjunction with what other keyword must OVRDTA and OVRATA be used?
Ans:PUTOVR keyword must used.

What is the purpose of the INDARA keyword?
Ans:This File-level keyword is used to remove option and response indicators from the buffer and places them in 99-byte separate indicator area.

Explain the purpose of KEEP and ASSUME keywords?
Ans:KEEP: Keep the display from being deleted when the display file is closed.
ASSUME: It is used to specify that the OS/400 program is to assume that this record is already shown on the display
when this file is opened.

Explain the use of DFTWRT display keyword?
Ans:No records will be displayed until there is any I/O operation.

What is the purpose of FRCDTA keyword ?
Ans:Immediately display a record format without waiting for the next I/O operation.

What keyword must be used with PROTECT keyword?
Ans:OVERLAY

What is Subfile?
Ans:Subfile is group of records of same record format and can be read from or write to the display in a single operation.

What are all the contents of subfile?
Ans:Subfile Record Format, Subfile Control Record Format, Relative Record Number, Subfile Record Number, Associated Subfile Keywords.

What are the two record formats a subfile contain ?
Ans:Subfile record forma (SFL), and subfile control record forma (SFLCTL).

What is SFLPAG and SFLSIZ ?
Ans:
SFLPAG : it is an attribute which specifies the number of records that can be displayed in a screen.
SFLSIZ : it is an attribute which specifies the number of records can be stored in subfile.

What is the maximum number of subfiles that can be specified in a display file,
Ans:512

Maximum number of subfiles that can Defined in a RPG program for one display file is
Ans:24

Maximum number of subfiles that can be active for a single file is?
Ans:12

Can more than one subfile record be displayed on one line?
Ans:Yes, by using SFLLIN keyword.

How do you specify the number of records to roll in a subfile?
Ans:Use SFLROLVAL keyword in DDS along with number, which specifies the number of records to scroll at a time.

How will you display a particular page in subfile?
Ans:Move a valid relative record number (RRN) in the field specified using SFLRCDNBR keyword in DDS.

How to pick up the changed records every time in a subfile after the first change made?
Ans:Seton SFLNXTCHG keyword indicator and update the subfile record.

What is the use of SFLEND keyword?
Ans:By specifying this keyword, the Bottom/More message could be displayed at end of screen.

How to toggle between single line and Multi – line display of a particular record in a subfile?
Ans:Using SFLDROP keyword.

Explain the difference between defining Subfile and Message-subfile?
Ans:Subfile record is defined by SFL keyword, where as Message subfile is defined by SFLMSG keyword.

What are the different types of variables available in CL?
Ans:DEC, CHAR, LGL

 

 

AS/400 Interview Questions Answers-section 9

 

A program variable coded in an Embedded SQL statement is referred to as?
Ans:Host Variable

Which of the CL command can be used to determine which logical files are dependent on a specific file?
Ans:DSPDBR

What does DFU program you to do on a record?
Ans:Insert, Update Delete & File Enquiry.

When are the Unique Constraints executed?
Ans:During Insert.

When are the Referential Constraints executed?
Ans:Insert, Update & Delete.

How many triggers can be associated with a file?
Ans:6(Maximum)

Why is the Declare cursor statement is used for?
Ans:To define & name the cursor & specify rows to be fetched.

What do we can do with the Embedded SQL statements?
Ans:We can Insert/Update/Delete records, fetch records, fetch values from records into variables.

Which CL command is used to trap error messages during program execution?
Ans:MONMSG

Which CL command can be used at program execution to redirect the file named in an RPG program?
Ans:OVRDBF

What is the length of the variable in the given example?
Ans:DCL VAR (&Name) TYPE (*Char)? Default 32 & for Decimal 15,5
We can determine weather a record is in use bye another user with the help of status code (*STATUS). If
*STATUS = 01218 i.e. record already locked.

How to write *PSSR ?
Ans:It just similar to any other subroutine.
*PSSR BEGSR
………………
………………
…………….
ENDSR

What is Procedure ?
Ans:A procedure is the set of self contained high level language statements that can perform a particular task and then returns to a caller.

What is Procedure Prototype and Procedure Interface.
Ans:
Procedure Prototype
In this section we specify the name of the procedure along with PR.
D PROC1 PR
Procedure Interface
It is section where we define all the parameter which are receiving or returning some values.
D PROC1 PI 5 0
D PARMA 5 0
D PARMB 5 0

How to define a procedure ?
Ans:
First we have define Procedure Prototype along with all parameter. And PR.
D PROC1 PR
Then define Procedure with Begin/End
Procedure Name Begin/End
P PROC1 B Export
Then define Procedure Interface along with parameter and PI
D PROC1 PI 5 0
D PARMA 5 0
D PARMB 5 0
Define all the parameters as a variable to the procedure
D PARMA S 5 0
D PARMB S 5 0
In not returnable procedure, the procedure should end with
C PROC1 E
In returnable procedure, it should end with
C RETURN PARMA + PARMB

 

How to define Global Parameter in ILE ?
Ans:Declare a variable with key word EXPORT and while using this variable in anther program declare with
IMPORT keyword.

What is the disadvantage of using Global variable?
Ans:We can not trace out at which point the value of variable is changed.

What is Service Program?
Ans:A Service Program is a collection of runnable procedures and available data items easily accessible by other ILE programs. In many respects it is similar to a subroutine library and procedure library.
A service program differs from a program in two ways:
It does not contain a program entry procedure. This means that you cannot call a service program using the CALL operation.
A service program is bound into a program or other service programs using binding by reference.

What is the structure of Service Program ? What is signature ?

What is *ISO date format?
Ans:YYYY-MM-DD for other formats refer to IBM manual or ERIS document.

If we tried to move year part of *ISO date into a field of length 3, what will happen ?
Ans:Program crashes, as in case of *ISO format it required fields of 4,2,2.

How to avoid using indicators in ILE ?
Ans:By using the standard Built In Expressions like %FOUND,%EOF, NOT %EOF, %BOF, NOT %BOF…etc.
Display / Printer File

Explain the keywords EDTCDE & EDTWRD
Ans:
EDTCDE & EDTWRD are key words used for formatting purpose. EDTCDE cannot be applied to Character filed. And EDTCDE has some Codes pre-defined for example,

EDTCDE(Z) – for suppressing the leading zero Y – for date field.
EDTWRD can be used to define user defined formatting for a fields.

Disadvantage of using Validity Check keyword? How to overcome these disadvantages ?
Ans:If invalid values are entered,
The option filed is displayed in reverse image.
System defined message is displayed which may not be user friendly.
Keyboard is locked, we have to reset it.
To overcome above disadvantage validations is done within program and user friendly/defined message is displayed.

What are the important factors in Error message subfile ?
Ans:We must define error message record format (SFLMSG). And a Program Queue. (PGMQ) and Record format is associated to a line number.

How to define to define a Hidden filed in DSPF ?
Ans:Define a filed in a DSPF of use HIDDEN.(H)

How To get the cursor position?
Ans:With the help of RTNCSRLOC keyword, here we need to define a field to get row and column. Length of variable should be 5,0 fixed We can specify *FILED for filed *REC for Record on which a key is pressed.

What is OVERLAY?
Ans:It allows a record format to be displayed on screen retaining the previous displayed record formats.

What key word is used when screen is re-display?
Ans:RSTDSP is a parameter to be specified at compile time for display file.

Command Attention key and Command Function Key ?
Ans:With the help of Command attention key we can pass only the indicator status to program not the data from screen. While command function key passes indicator status as well as a data from screen to program.

How to validate input values in Display file ?
Ans:With the help of Validity check key words VALUE, RANGE, COMP

What is the stored procedure and how do you define a stored procedure.
Ans: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 applications.

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.
Using Nested Select statement
SELECT * FROM FILE1
WHERE FILE1.FLD1 EQ (SELECT FILE2.FLD1 FROM FILE2)

How do you achieve referential integrity?
Ans:By adding Referential Integrity Constraints to a Physical file or Logical file. Constraints like PRIMARY KEY, FOREGIN KEY, DELETE RULE, UPDATE RULE. ETC.
Commands are ADDPFCST for Physical file and ADDLFCST for Logical file.

Type of constraints
*REFCST – A referential constraint is being added
*UNQCST – A unique constraint is being added.
*PRIKEY – A primary key constraint is being added
*CHKCST – A check constraint is being added

Type of Delete rule (DLTRULE)
*NOACTION –
1. Deleting a record in parent file is permitted (not restricted) if data for a non-null parent key does not match data for a foreign key.
Deleting a record in a parent file is restricted (does not occur) if data for a non-null parent key matches data for a foreign key.
*RESTRICT –
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.
Deleting a record in a parent file is restricted if data for a non-null parent key matches data for a foreign key.

*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.
Type of Update rule (UPDRULE)
*NOACTION – No Action

*RESTRICT –
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.
Updating a record in a parent file is restricted if data for a non-null parent key matches data for a foreign key.

Where Stored procedure lies in the system.
Ans:If we want to have a look where the stored procedure, we can have a look through SQL.
Select * from

Different type of Cursor?
Ans: Two types of Cursor
Simple / Serial Cursor
A serial cursor is one defined without SCROLL key word
For serial cursor each row is fetched only once per OPEN
When it is opened it is positioned before the first row in the table.
To use serial cursor we have to re-issue OPEN

Scrollable Cursor which is defined with SCROLL key word.
Cursor defined with SCROLL key word
Rows of cursor can be fetched many times
When it is opened it is positioned before the first row in the table.
When the FETCH is issued , the cursor is positioned to the row of the table that is specified by the POSITION option. (FIRST, LAST, PREV, NEXT, RELATIVE)

Writing an SQL statement from selecting records from TWO files using single statement and Nested select statement.
Ans: Using Single statement.
SELECT * FROM FILE1, FILE2
WHERE FILE1.FLD1 = FILE2.FLD1

Difference between View and Index ?
Ans:View will not any data.. It only shows a data from table while Index has a Indexing Data for a sequence on which Index is created. View is similar to Logical file without having Key and Index is similar to Logical File having Key (as keyed logical file has access path data) Table is similar to PF.

Can we have records (with fields from more than one file) from multiple files and Nested / sub query in SQL ?
Ans: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)

What is the sequence when using CURSOR?
Ans: Define Cursor ,Declare Cursor ,Open Cursor ,Fetch record ,Processing ,Close Cursor

 

AS/400 Interview Questions with Answers

AS/400 Interview Questions Answers-section 7

 

What the purpose of the keywords FIFO, LIFO, FCFO?
Ans:These keywords are used at file level. The purpose of each one is described below:
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.

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.

Distinguish between logical file and physical file?
Ans:Physical file contains only one record format.
Logical file contains more than one record format.
Physical file contains actual data.
Logical file doesn’t contains data but it provides view from the physical file.

What is field reference file?
Ans:Field reference file is a file, which contains field definitions and descriptions, and it doesn’t have member. Physical contains data derived by the field reference file.

What is the difference between access path and Dynamic select?
Ans:Dynamic select occurs whenever the program reads file. But access path occurs before the file is read (but not necessarily). Because access path maintenance performed on the file.

Why would you prefer OPNQRYF than logical file?
Ans:The main difference is : Logical file creates permanent object on the system. OPNQRYF creates temporary access path.

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 is purpose of declarative statement DEFN?
Ans:Depends on the factor 1 value it will do two things:
* If the factor1is *LIKE then DEFN opcode defines the new field based on the attributes old field. * If the factor 1 is *NAMVAR then DEFN opcodes defines the field as a data area.

What is the purpose of SFLNXTCHG keyword in a subfile?
Ans:Which is a subfile record format keyword. If you perform read on the subfile, the
internal indicator MDT (modified data tag) is automatically set off by the system. If you again perform read on the
same records, records won’t be read. Because internal indicator MDT would be off. Hence you should be explicitly set
on the MDT by SFLNXTCHG keyword.

What is the difference between Array and Table?
Ans:
Array: Array is stored any where in the body of the input records.
Table: Table is stored at the begining of the input records.
Array: We can access all the elements in array by specifying the array name.
Table: Only one table element can be accessed at a time.
Array: Array can be searched randomly.
Table: Table can be searched consecutively.

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.

What is the purpose of reorganizing the physical file i. e. , RGZPFM?
Ans:Even if you delete the records in a physical file through the program, still the space used by the deleted records not used by the other purpose. Hence using RGZPFM command we can compress the deleted records space.

What is the purpose of CHGPF (Change physical file) command?
Ans:CHGPF command is used to change the attributes of a physical file. Attributes like
* Maximum number of members
* Member size
* Level check enforced
* Open data path is shared

How can you identify End of file in CLP program?
Ans:With the help of MONMSG MSGID(CPF0864) we can identify end of file in clp program.

What is the difference between production library and test library ?
Ans:In debug mode, the files exists in production library not allowed to update.
In the other hand, the files exists in test library allowed to update.

 

Give three main purposes of File specification ?
Ans:To define files, to describe the files, to assign the files to specified devices.

How do you specify page overflow indicator for printer files in RPG?
Ans:Specify an indicator in position 33-34 of F specification.

What is a Primary File?
Ans:It is used in RPG Program Cycle to automatically read records in a cycle.

Can a indexed file be accessed in arrival sequence in RPG program?
Ans:Yes.

What opcode could be used to test an alphanumeric field for all numeric values?
Ans:TESTN

What opcode will be used to test the zone of a character field?
Ans:TESTZ

How to read database records without locking them?
Ans:Put ‘N’ in position 53 of C specs.

What does CHECK opcode is used?
Ans:The check operation verifies that each character in the base string (factor 2) is among the character indicated in the comparator string (factor 1).

What does ‘SR’ in columns 7-8 of C specs mean?
Ans:Calculation operation is a part of RPG subroutine.

What is SCAN and XLATE?
Ans:SCAN operation scans a character string (base string) contained in factor 2 for a substring (compare string ) contained in factor 1.
XLATE operation translates characters in source string (factor 2 ) to the from and to strings (factor 1 ) and put into the result field.

How do you use commitment control in RPG program ?
Ans:Using COMIT operation. Makes all changes to the files that have been specified in output operation since the previous COMIT or the begining of operations under commitment control(if there has been no previous COMIT or ROLBK operation).

How do you use exceptional write in C specs?
Ans:Using EXCPT opcode.

What does the opcode FREE do?
Ans:The FREE operation removes a program from the list of activated programs, frees static storage and ensures program initialization (first cycle processing) the next time program is called. It does not close file or unlock data area.

What does opcode POST do?
Ans:Puts information in INFDS.

What is the maximum number of elements in an array?
Ans:9999

What is a Program Described file in RPG?
Ans:The field name and length of the fields are defined with in the RPG program.

What is externally described file ?
Ans:All information about the fields is specified in DDS and the RPG program can use them with in the program.

Can you specify a display file to be used in the following modes Input, Output, or Combined modes ?
Ans:Yes.

What is match field indicator?
Ans:Matching record indicator is seton when all the matching fields in the record of a secondary file matches with all the matching fields of a record in a primary file.

What is the length of a variable in RPG?
Ans:6 Characters.

When is a TAG statement used in RPG?
Ans:It is used as Label.

Can we define Multi-dimensional arrays in RPG?
Ans:No.

What is XFOOT opcode?
Ans:Adds all the elements in a numeric array, and places the sum in the result field.

How can we sort an array?
Ans:By using SORTA opcode.

What is Program Status Data Structure?
Ans:A Program status DS can defined to make program exception/error information available to an RPG program.
DS is defined as program status DS by an S in position 18 of the DS statement.
*STATUS contains status code.
*ROUTINE : contains name of routine in which the exception/error occurred
*PARMS : contains the number parameters passed to this program from the calling program.

What is the maximum number of times Multiple Occurrences DS can occur in a program?
Ans:9999

What are all the compiler directive statements?
Ans:/TITLE, /SPACE, /EJECT, /COPY

What is SAA?
Ans:Systems Application Architecture (SAA) is a collection of selected software interfaces, conventions, and protocols that will provide a consistent framework across the System/370, AS/400 and PS/2.
During execution, an RPG/400 program automatically follows a sequence of operations for each record that is processed. The built-in program cycle includes
the following logical steps.
1. reading input (READ)
2. processing calculations (PROCESS)
3. writing output (WRITE)

What is the Function of PDM?
Ans:Productivity tool for copying, deleting, scanning, changing & creating source files.

What is the function of SEU ?
Ans:A utility for editing programming language source code.

How can the user implicitly open and close the files in RPG program ?
Ans:Enter UC in position 71-72 of F specs.
Use OPEN and CLOSE opcodes in RPG program to open and close files.

How many parameters can be defined in a RPG program. ?
Ans:255

What is File Information Data Structure?
Ans:File Information Data structure (INFDS) can be defined for each file to make file exception/error information available to the program. A file information data structure contains predefined subfields that identify: the name of the file for which the exception/error occurred. the record being processed when the exception/error occurred or the record that caused the exception/error. The last operation being processed when the exception/error
occurred.The status code. The RPG routine in which the exception/error occurred.

What is the use of SDA ?
Ans:Screen Design Aid is used to create display files interactively.