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