TOP Mainframe Interview Questions and Answers
How do you come out of an EVALUATE statement?
After the execution of one of the when clauses, the control is automatically passed on to the next sentence after the EVALUATE statement.
There is no need of any extra code.
What is the difference between COMP & COMP-3 ?
COMP is a binary storage format while COMP-3 is packed decimal format.
Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?
Can rewrite(record length must be same), but not delete.
What is the difference between index and subscript?
Subscript refers to the array occurrence while index is the displacement (in no of bytes) from the beginning of the array. An index can only be modified using PERFORM, SEARCH & SET. Need to have index for a table in order to use SEARCH, SEARCH ALL.
In an EVALUATE statement, can I give a complex condition on a when clause?
What is COMP-1? COMP-2?
COMP-1 – Single precision floating point. Uses 4 bytes.
COMP-2 – Double precision floating point. Uses 8 bytes.
What is file status 92?
Logic error. e.g., a file is opened for input and an attempt is made to write to it.
What is the difference between SEARCH and SEARCH ALL?
SEARCH – is a serial search.
SEARCH ALL – is a binary search & the table must be sorted ( ASCENDING/DESCENDING KEY clause to be used & data loaded in this order)
before using SEARCH ALL.
What is a scope terminator? Give examples.
Scope terminator is used to mark the end of a verb e.g. EVALUATE, END-EVALUATE; IF, END-IF.
How do you define a variable of COMP-1? COMP-2?
No picture clause to be given. Example 01 WS-VAR USAGE COMP-1.
What is file status 39 ?
What should be the sorting order for SEARCH ALL?
It can be either ASCENDING or DESCENDING. ASCENDING is default. If you want the search to be done on an array sorted in descending order, then while defining the array, you should give DESCENDING KEY clause. (You must load the table in the specified order).
How do you do in-line PERFORM?
PERFORM … …
How many bytes does a S9(7) COMP-3 field occupy ?
Will take 4 bytes. Sign is stored as hex value in the last nibble.
General formula is INT((n/2) + 1)), where n=7 in this example.
What is binary search?
Search on a sorted array. Compare the item to be searched with the item at the center. If it matches, fine else repeat the process with the left half or the right half depending on where the item lies.