Top Mainframe Interview Questions ( 3 of 3)

The following are interview questions asked in COBOL

Q1). Difference between COMP and COMP-3?

A1). Comp- is binary variable. It is more efficient at boundaries. Comp-3 – is packed decimal. It is more efficient in computations.

Q2). Redefines advantages?

A2). Redefines is possible at same level. And, Since redefined fields share the same space, by definition they have the same size. Although recent compilers (COBOL85 and later) will permit redefined fields to be larger or smaller than the initial definition, and automatically adjust both definitions to the largest field, it’s convention (and good programming practice) to define them to be the same size, by adding a FILLER field if necessary.

Q3). In COMP3, how many bytes can we give?

A3). Max limit in COBOL is 18

Q4). What is Segregated Fund ?

A4). This is mutual fund domain Question. It is combination of LIC policy and Growth fund.

Q5). How to read last record in COBOL file?



We can use temporary array in COBOL. Just keep DECENDING in array. Then first record of an Array becomes last record of the input file:

COBOL logic:

 perform read-para until EOF
 display temp.
 read file until EOF='Y'.
 if not EOF then
 move low values to temp.
 move inrec to temp. 


If we know Key value, we can find last record dynamically

The following questions asked in JCL interview

Q1). How can we override COND value in proc?

A1). In PROC step, need to give COND.procstepname=(5,GT)

Q2). What is GDG?

A2). GDGs we use to store data of multiple versions. For examples, weekly, monthly and quarterly files etc

Q3). What is IEFBR14?

A3). It is do-nothing utility. It is used in JCLs to create or Delete a dataset dynamically. Ref: click HERE

Q4). How to extract duplicate records from a file?

//SORTXSUM DD DSN=datasetname,
//            SPACE=(CYL,(1,4),RLSE),
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN    DD *

The following questions asked in DB2 interview

Q1). What is EXCEPTION join?

A1). This is very rarely used in DB2 SQL. However, some old DB2 of I-series following this join. Left outer join, retrieves rows from Left side table non-matching rows and matching rows of both the table. In this case, it returns, non-matching rows of left side table.

Q2). What is JOIN?

A2). It is a silly question. Main usage is to get data from multiple joins

Q3). What is COALESCE function in DB2?

A3). COALESCE, returns first non NULL value. COALESCE(Select name from emp where dept=10,1000); If no department found, it replaces, with 1000.


Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.