Mainframes Interview -COBOL Interview Question and answers
When would you use in-line perform?
How is sign stored in a comp-3 field?
What is a scope terminator?
What is an in line PERFORM?
What is the linkage section?
What is 88 level used for?
How many sections are there in data division?
What do you feel makes a good program?
What compiler option would you use for dynamic linking?
What are VS COBOL 11 special features?
What is file status 39?
How do you code COBOL to access a parameter
What is a subscript?
What is the point of the REPLACING option of
What is 77 level used for?
What is CALL statement in COBOL?
When is a scope terminator mandatory?
The maximum number of dimensions that an
What is file status 92?
How do you define the files referred to in a
How include time & date in the report generation
What is an explicit scope terminator?
How to execute a set of JCL statements from
How do you set a return code to the JCL from
Name some of the examples of COBOL 11?
What are the two search techniques?
How do you define a table/array in COBOL?
What is Static and Dynamic linking?
What is the maximum size of a 01 level item in COBOL II?
What is redefines clause?
Why occurs can not be used in 01 level?
What are options have been removed in COBOL 11?
How does IDMS communicate with CICS?
What is the pertinent COBOL?
What is the difference between external and global variables?
What is SET TO TRUE all about, anyway?
How can I tell if a module is being called
What is the difference between a subscript and
What is the reference modification?
What are the functions like c or c++ in COBOL?
What should be the sorting order for SEARCH ALL?
What is the difference between comp and comp-3 usage?
What is the Purpose of POINTER Phrase in STRING command?
How do you sort in a COBOL program?
What divisions, sections and paragraphs are
How do you do in-line PERFORM?
What is the difference between COMP & COMP-3?
What is SSRANGE, NOSSRANGE?
How is sign stored in a COMP field?
What is the use of EVALUATE statement?
What R 2 of the common forms of the EVALUATE STATEMENT?
What is COMP SYNC?
What are the differences between COBOL and COBOL II?
What is LENGTH in COBOL II?
What are the steps you go through while creating
What is the file organization clause?
What is the meaning of 'TALLING' verb in COBOL?
What is binary search?
What is the maximum length of a field you can
What are the differences between OS VS COBOL
What are the different forms of EVALUATE statement?
What is the mode in which you will OPEN a file for writing?
What does the initialize statement do?
Why we are giving more preference to COBOL?
What is difference between COBOL and VS COBOL II?
What are the different data types available in COBOL?
What COBOL construct is the COBOL II EVALUATE
How do you come out of an EVALUATE statement?
What is the purpose of Identification Division?
What is report-item?
What is Alternate Index? How is it different from
How can you pass values from COBOL program
What does EXIT do?
What is the difference between a DYNAMIC
What is the difference between Structured COBOL
What is the maximum size of a 01 level item in COBOL I?
What is level 66 used for?
What is the difference between SEARCH and SEARCH ALL?
When can the USING phrase be included in the call statement?
What are the pertinent COBOL commands?
How is sign stored in Packed Decimal fields
What is the difference between performing a
What does the INITIALIZE verb do?
Difference between next and continue clause
What is the significance of 'above the line' and 'below the line'?
What is an in-line perform?
How can we pass data from COBOL to JCL?
What are differences between COBOL and java?
What is the difference between PIC 9.99 and 9v99?
What are the advantages of REDEFINES clause?
What is the difference between NEXT SENTENCE
What the difference is between CONTINUE &
How can you submit a job from COBOL programs?
What do you do to resolve SOC-7 error?
What is the different between index and subscript?
What is the meaning of 'Eject' verb in COBOL?
How does IDMS insure data integrity?
What is COMP-1 and COMP-2?
What was removed from COBOL in the COBOL
What are different file OPEN modes available in COBOL?
How do we get current date from system with century?
What is the LINKAGE SECTION used for?
What is the difference between a binary search
What is an index for tables?
What is the difference between a binary search
How to resolve the soc4 and soc7 errors?
How do you submit JCL via a COBOL program?
How may divisions are there in JCL-COBOL?
Describe the difference between subscripting
What are some examples of command terminators?
What is the Importance of GLOBAL clause
What is difference between comp & comp-4?
What is the difference between index and subscript?
What is the difference between an internal and
What care has to be taken to force program to
What does the IS NUMERIC clause establish?
What is the difference between SEARCH and
What guidelines should be followed to write a
What is the difference between static call & Dynamic call?
How would the number 1234 be stored in EBCDIC?
What the difference is between write & move in COBOL?
Showing posts with label cobol interview faqs. Show all posts
Showing posts with label cobol interview faqs. Show all posts
COBOL Interview questions and answers,Mainframes Interview question and answers
COBOL Interview questions and answers,Mainframes Interview question and answers
Q1) Name the divisions in a COBOL program ?.
A1) IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, PROCEDURE DIVISION.
Q2) What are the different data types available in COBOL?
A2) Alpha-numeric (X), alphabetic (A) and numeric (9).
Q3) What does the INITIALIZE verb do? - GS
A3) Alphabetic, Alphanumeric fields & alphanumeric edited items are set to SPACES. Numeric, Numeric edited items set to ZERO. FILLER , OCCURS DEPENDING ON items left untouched.
Q4) What is 77 level used for ?
A4) Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.
Q5) What is 88 level used for ?
A5) For condition names.
Q6) What is level 66 used for ?
A6) For RENAMES clause.
Q7) What does the IS NUMERIC clause establish ?
A7) IS NUMERIC can be used on alphanumeric items, signed numeric & packed decimal items and unsigned numeric & packed decimal items. IS NUMERIC returns TRUE if the item only consists of 0-9. However, if the item being tested is a signed item, then it may contain 0-9, + and - .
Q8) How do you define a table/array in COBOL?
A8) ARRAYS.
05 ARRAY1 PIC X(9) OCCURS 10 TIMES.
05 ARRAY2 PIC X(6) OCCURS 20 TIMES INDEXED BY WS-INDEX.
Q9) Can the OCCURS clause be at the 01 level?
A9) No.
Q10) What is the difference between index and subscript? - GS
A10) 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.
Q11) What is the difference between SEARCH and SEARCH ALL? - GS
A11) 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.
Q12) What should be the sorting order for SEARCH ALL? - GS
A12) 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).
Q13) What is binary search?
A13) 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.
Q14) My program has an array defined to have 10 items. Due to a bug, I find that even if the program access the
11th item in this array, the program does not abend. What is wrong with it?
A14) Must use compiler option SSRANGE if you want array bounds checking. Default is NOSSRANGE.
Q15) How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning. - GS
A15) Syntax: SORT file-1 ON ASCENDING/DESCENDING KEY key.... USING file-2 GIVING file-3.
USING can be substituted by INPUT PROCEDURE IS para-1 THRU para-2
GIVING can be substituted by OUTPUT PROCEDURE IS para-1 THRU para-2.
file-1 is the sort (work) file and must be described using SD entry in FILE SECTION.
file-2 is the input file for the SORT and must be described using an FD entry in FILE SECTION and SELECT
clause in FILE CONTROL.
file-3 is the out file from the SORT and must be described using an FD entry in FILE SECTION and SELECT
clause in FILE CONTROL.
file-1, file-2 & file-3 should not be opened explicitly.
INPUT PROCEDURE is executed before the sort and records must be RELEASEd to the sort work file from the input procedure.
OUTPUT PROCEDURE is executed after all records have been sorted. Records from the sort work file must be RETURNed one at a time to the output procedure.
Q16) How do you define a sort file in JCL that runs the COBOL program?
A16) Use the SORTWK01, SORTWK02,..... dd names in the step. Number of sort datasets depends on the volume of data
being sorted, but a minimum of 3 is required.
Q17) What is the difference between performing a SECTION and a PARAGRAPH? - GS
A17) Performing a SECTION will cause all the paragraphs that are part of the section, to be performed.
Performing a PARAGRAPH will cause only that paragraph to be performed.
Q18) What is the use of EVALUATE statement? - GS
A18) Evaluate is like a case statement and can be used to replace nested Ifs. The difference between EVALUATE and
case is that no 'break' is required for EVALUATE i.e. control comes out of the EVALUATE as soon as one match is
made.
Q19) What are the different forms of EVALUATE statement?
A19)
EVALUATE EVALUATE SQLCODE ALSO FILE-STATUS
WHEN A=B AND C=D WHEN 100 ALSO '00'
imperative stmt imperative stmt
WHEN (D+X)/Y = 4 WHEN -305 ALSO '32'
imperative stmt imperative stmt
WHEN OTHER WHEN OTHER
imperative stmt imperative stmt
END-EVALUATE END-EVALUATE
EVALUATE SQLCODE ALSO A=B EVALUATE SQLCODE ALSO TRUE
WHEN 100 ALSO TRUE WHEN 100 ALSO A=B
imperative stmt imperative stmt
WHEN -305 ALSO FALSE WHEN -305 ALSO (A/C=4)
imperative stmt imperative stmt
END-EVALUATE END-EVALUATE
Q20) How do you come out of an EVALUATE statement? - GS
A20) 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.
Q1) Name the divisions in a COBOL program ?.
A1) IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, PROCEDURE DIVISION.
Q2) What are the different data types available in COBOL?
A2) Alpha-numeric (X), alphabetic (A) and numeric (9).
Q3) What does the INITIALIZE verb do? - GS
A3) Alphabetic, Alphanumeric fields & alphanumeric edited items are set to SPACES. Numeric, Numeric edited items set to ZERO. FILLER , OCCURS DEPENDING ON items left untouched.
Q4) What is 77 level used for ?
A4) Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.
Q5) What is 88 level used for ?
A5) For condition names.
Q6) What is level 66 used for ?
A6) For RENAMES clause.
Q7) What does the IS NUMERIC clause establish ?
A7) IS NUMERIC can be used on alphanumeric items, signed numeric & packed decimal items and unsigned numeric & packed decimal items. IS NUMERIC returns TRUE if the item only consists of 0-9. However, if the item being tested is a signed item, then it may contain 0-9, + and - .
Q8) How do you define a table/array in COBOL?
A8) ARRAYS.
05 ARRAY1 PIC X(9) OCCURS 10 TIMES.
05 ARRAY2 PIC X(6) OCCURS 20 TIMES INDEXED BY WS-INDEX.
Q9) Can the OCCURS clause be at the 01 level?
A9) No.
Q10) What is the difference between index and subscript? - GS
A10) 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.
Q11) What is the difference between SEARCH and SEARCH ALL? - GS
A11) 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.
Q12) What should be the sorting order for SEARCH ALL? - GS
A12) 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).
Q13) What is binary search?
A13) 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.
Q14) My program has an array defined to have 10 items. Due to a bug, I find that even if the program access the
11th item in this array, the program does not abend. What is wrong with it?
A14) Must use compiler option SSRANGE if you want array bounds checking. Default is NOSSRANGE.
Q15) How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning. - GS
A15) Syntax: SORT file-1 ON ASCENDING/DESCENDING KEY key.... USING file-2 GIVING file-3.
USING can be substituted by INPUT PROCEDURE IS para-1 THRU para-2
GIVING can be substituted by OUTPUT PROCEDURE IS para-1 THRU para-2.
file-1 is the sort (work) file and must be described using SD entry in FILE SECTION.
file-2 is the input file for the SORT and must be described using an FD entry in FILE SECTION and SELECT
clause in FILE CONTROL.
file-3 is the out file from the SORT and must be described using an FD entry in FILE SECTION and SELECT
clause in FILE CONTROL.
file-1, file-2 & file-3 should not be opened explicitly.
INPUT PROCEDURE is executed before the sort and records must be RELEASEd to the sort work file from the input procedure.
OUTPUT PROCEDURE is executed after all records have been sorted. Records from the sort work file must be RETURNed one at a time to the output procedure.
Q16) How do you define a sort file in JCL that runs the COBOL program?
A16) Use the SORTWK01, SORTWK02,..... dd names in the step. Number of sort datasets depends on the volume of data
being sorted, but a minimum of 3 is required.
Q17) What is the difference between performing a SECTION and a PARAGRAPH? - GS
A17) Performing a SECTION will cause all the paragraphs that are part of the section, to be performed.
Performing a PARAGRAPH will cause only that paragraph to be performed.
Q18) What is the use of EVALUATE statement? - GS
A18) Evaluate is like a case statement and can be used to replace nested Ifs. The difference between EVALUATE and
case is that no 'break' is required for EVALUATE i.e. control comes out of the EVALUATE as soon as one match is
made.
Q19) What are the different forms of EVALUATE statement?
A19)
EVALUATE EVALUATE SQLCODE ALSO FILE-STATUS
WHEN A=B AND C=D WHEN 100 ALSO '00'
imperative stmt imperative stmt
WHEN (D+X)/Y = 4 WHEN -305 ALSO '32'
imperative stmt imperative stmt
WHEN OTHER WHEN OTHER
imperative stmt imperative stmt
END-EVALUATE END-EVALUATE
EVALUATE SQLCODE ALSO A=B EVALUATE SQLCODE ALSO TRUE
WHEN 100 ALSO TRUE WHEN 100 ALSO A=B
imperative stmt imperative stmt
WHEN -305 ALSO FALSE WHEN -305 ALSO (A/C=4)
imperative stmt imperative stmt
END-EVALUATE END-EVALUATE
Q20) How do you come out of an EVALUATE statement? - GS
A20) 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 are the different divisions in Cobol Program
Divisions in cobol program are
1)IDENTIFICATION DIVISION
2)ENVIRONMENT DIVISION
3)DATA DIVISION
4)PROCEDURE DIVISION
1)IDENTIFICATION DIVISION
2)ENVIRONMENT DIVISION
3)DATA DIVISION
4)PROCEDURE DIVISION
Subscribe to:
Posts (Atom)