Mainframe Interview Questions

Q:

How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning.

Answer

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

Report Error

View answer Workspace Report Error Discuss

0 1753
Q:

What guidelines should be followed to write a structured COBOL program ?

Answer

Following guidelines to be following while writing Cobol program:


- Use ? EVALUATE ? statement for constructing cases.


- Use scope terminators for nesting.


- Use in-line Perform statement for writing ?do? constructions.


- Use Test Before and Test After in the Perform statement while writing Do-While statements.

Report Error

View answer Workspace Report Error Discuss

0 1717
Q:

What is COPY PENDING status?

Answer

- A status occurs when image copy on a table needs to be taken


- The table is available only for queries and can not be updated


- COPY PENDING status can be removed by taking away the image copy or by using REPAIR utility

Report Error

View answer Workspace Report Error Discuss

0 1678
Q:

What is meant by index cardinality?

Answer

The number of distinct values for a column is called index cardinality. DB2's RUNSTATS utility analyzes column value redundancy to determine whether to use a tablespace or index scan to search for data.

Report Error

View answer Workspace Report Error Discuss

0 1652
Q:

What is the self-referencing constraint?

Answer

A31. The self-referencing constraint limits in a single table the changes to a primary key that the related foreign key defines. The foreign key in a self referencing table must specify the DELETE CASCADE rule.

Report Error

View answer Workspace Report Error Discuss

0 1651
Q:

How will u send data from a cobol file to db2 table?

Answer

USING HOST VARIABLE we can pass data from COBOL to DB2

Report Error

View answer Workspace Report Error Discuss

0 1647
Q:

What is the CICS LOAD command ?

Answer

The LOAD command retrieves an object program from disk and loads it into main storage - it's primarily used for a constant table that will be available system-wide.


 

Report Error

View answer Workspace Report Error Discuss

0 1641
Q:

What is the need to code COMMITS in batch programs?

Answer

COMMIT statements are used to release locks which are required for that unit of work, and then permit a new unit of work. In other words, if COMMITS are not coded in the program and the program has been sent for execution, then while processing, in place of just going back to a few inserts since the nearest commit, the program has to go back to the inserts which were made during the entire run of the program. This extra process takes around twice or thrice the time taken normally.

Report Error

View answer Workspace Report Error Discuss

0 1640