Recently my friend attended for mainframe interview at Mphasis. Here are those questions that he shared.
Mphasis mainframe interview questions
1. Search and Search all?
Search is a sequential search and search-all is a binary search. Here is a post on How to Use COBOL “Search” and “Search all” Correctly.
2. How many ways one can pass data to the COBOL program from JCL?
- Input file
- JCL Parm parameter
- Sysin card
3. Can we copy the empty PS file to the VSAM file through JCL?
Yes, you can do it, you will not get any errors.
Sample code
The input file is a PS file and the Output file is a VSAM file.
//REPRO2 JOB ...
//STEP1 EXEC PGM=IDCAMS
//INPUT DD DSNAME=SEQ.DRGV,DISP=SHR,DCB=(BUFNO=6)
//SYSPRINT DD SYSOUT=A
//SYSIN DD *
REPRO -
INFILE(INPUT) -
OUTDATASET(RPR.MYDATA)-
ERRORLIMIT(6) /* error limit */
/*
4. How to check if the input PS file is empty?
The best way you can use IDCAMS/IEBPTCH utilities. Here is a post EMPTY File condition check using JCL utilities.
5. How to merge two CSV files using DFSORT?
You can use JOINKEYS to merge two files.
JOINKEYS is a powerful DFSORT function that helps you to perform various “join” and “match” applications on two data sets by one or more keys. You can do an inner join, full outer join, left outer join, right outer join, and unpaired combinations. The two data sets can be of different types (fixed, variable, VSAM, and so on) and lengths, and have keys in different locations. You can even do cartesian joins. For added flexibility, the records from the input data sets can be processed in a variety of ways before and after they are joined using other DFSORT control statements such as INCLUDE, OMIT, INREC, OUTREC, SUM, and OUTFIL.
6. Isolations levels in DB2?
There are four isolation levels. Here is an article DB2 Four Isolation Levels RR, RS, CS, UR- Best examples.
7. Where do you give isolation levels?
During BIND time.
8. How to update only 100 records?
You can use cursor logic. And use the counter to count each record updated. After, the 100th record the logic will come out of the cursor, and you can close the cursor.
9. What are -811, -501, and -922 errors?
The -922 is authorization related. You can see all other SQL error codes here.
10. How to eliminate duplicates using SORT?
SUM FILEDS=NONE
Related