IBM MainFrame Interview Preparation Guide
Sharpen your IBM MainFrame interview expertise with our handpicked 28 questions. Each question is designed to test and expand your IBM MainFrame expertise. Suitable for all experience levels, these questions will help you prepare thoroughly. Get the free PDF download to access all 28 questions and excel in your IBM MainFrame interview. This comprehensive guide is essential for effective study and confidence building.28 IBM MainFrame Questions and Answers:
1 :: How to fetch even records from one file to another file by using ICETOOL in JCL?
//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT.DATA,DISP=SHR
//OUTDATA DD DSN=OUTPUT.DATA,DISP=(NEW,CATLG,DELETE)
.
.
.
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUTDATA,SAMPLE=2
THIS WILL COPY ALL EVEN RECORDS
-------------------------------------------
FOR ODD RECORDS
OUTFIL FNAMES=OUTDATA,STARTREC=1,SAMPLE=2
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT.DATA,DISP=SHR
//OUTDATA DD DSN=OUTPUT.DATA,DISP=(NEW,CATLG,DELETE)
.
.
.
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUTDATA,SAMPLE=2
THIS WILL COPY ALL EVEN RECORDS
-------------------------------------------
FOR ODD RECORDS
OUTFIL FNAMES=OUTDATA,STARTREC=1,SAMPLE=2
2 :: File1 has 100 records and file2 has 200 records i want to copy 50 records which r in both file into file3?
First need to sort both files
READ FILE1
READ FILE2
PERFORM UNTIL EOF = 'Y'
IF FILE1-ID > FILE2-ID THEN
READ FILE2 AT END MOVE 'Y' TO EOF
ELSE IF FILE1-ID < FILE2-ID
READ FILE1 AT END MOVE 'Y' TO EOF
ELSE IF FILE1-ID = FILE2-ID
WRITE FILE3
READ FILE1 AT END MOVE 'Y' TO EOF
READ FILE2 AT END MOVE 'Y' TO EOF
END-PERFORM
READ FILE1
READ FILE2
PERFORM UNTIL EOF = 'Y'
IF FILE1-ID > FILE2-ID THEN
READ FILE2 AT END MOVE 'Y' TO EOF
ELSE IF FILE1-ID < FILE2-ID
READ FILE1 AT END MOVE 'Y' TO EOF
ELSE IF FILE1-ID = FILE2-ID
WRITE FILE3
READ FILE1 AT END MOVE 'Y' TO EOF
READ FILE2 AT END MOVE 'Y' TO EOF
END-PERFORM
3 :: What is use of linkage section?
Linkage section is used to accept data from outside the program.either its parm part of Jcl or Call from any other programs,they pass data into called program thru linkage section only.
4 :: What is difference between comp and comp-3?
Comp is binary.its the type how system stores ur data.
pic s9(1)-->pics9(4) --occupies 2bytes
pic s9(5)---pic s9(8) ----4 bytes
pic s9(9)---pics9(18)-----8 bytes
comp-3 is for packed decimal data where each character occupies half byte and sign is stored in last nibble.
pic s9(1)-->pics9(4) --occupies 2bytes
pic s9(5)---pic s9(8) ----4 bytes
pic s9(9)---pics9(18)-----8 bytes
comp-3 is for packed decimal data where each character occupies half byte and sign is stored in last nibble.
5 :: How do define Dynamic array in COBOL how do u define single dimensional array and multidimensional array in your COBOL?
In IBM Cobol
1) In IBM's Language Environment you can dynamically
acquire storage (look up HEAP in the manual). The storage
you acquire you can use as you like. Can be an array,
therefore a dynamic array. It is a "work-around" as dynamic
arrays are not directly supported.
2) 01 SINGLE-DIM-ARRAY
05 SDA-ITEM PIC X OCCURS 30.
A single-dimension array of thirty one-byte characters.
3) 01 MULTI-DIM-ARRAY.
05 MDA-FIRST-DIM OCCURS 20.
07 MDA-SECOND-DIM OCCURS 30 PIC X.
A multi-dimension array of 20 times 30 one-byte characters.
1) In IBM's Language Environment you can dynamically
acquire storage (look up HEAP in the manual). The storage
you acquire you can use as you like. Can be an array,
therefore a dynamic array. It is a "work-around" as dynamic
arrays are not directly supported.
2) 01 SINGLE-DIM-ARRAY
05 SDA-ITEM PIC X OCCURS 30.
A single-dimension array of thirty one-byte characters.
3) 01 MULTI-DIM-ARRAY.
05 MDA-FIRST-DIM OCCURS 20.
07 MDA-SECOND-DIM OCCURS 30 PIC X.
A multi-dimension array of 20 times 30 one-byte characters.
6 :: How To get the last record in VSAM file in cluster? And How can u get the ksds file records into ur COBOL program? Please tell me about these two questions.?
Move highvalues to the key of the VSAM file and the issue Readnext record command. Then give Readprev command. This will read the last record. In VSAM, there is one command HURBA, Using that we can read the last record, If you want to know more about go to IBM RED BOOKS. You will get the solution.
by using the HURBA we can get the max records by using the CKD count key data we will get the last record
by using the HURBA we can get the max records by using the CKD count key data we will get the last record
7 :: Tell about How do u eliminate the duplicates?
By using DFSORT we can eliminate the duplicates
//Sysin dd *
sort fields=(1,5,ch,A)
sum fields=
/*
//
in the above dfsort we use sum fields= empty then it
eliminate the duplicates
if u want all dupli.in one file u can use
sum fields = xsum........
//Sysin dd *
sort fields=(1,5,ch,A)
sum fields=
/*
//
in the above dfsort we use sum fields= empty then it
eliminate the duplicates
if u want all dupli.in one file u can use
sum fields = xsum........
8 :: What is difference b/w file-aid tool and file-aid utility?
File-aid tool is online tool (application) used for
processing files using online screens. File-aid utility is
used in jcl for processing files in batch.
processing files using online screens. File-aid utility is
used in jcl for processing files in batch.
9 :: How to override a dsn that is contained in a proc called by another proc? I need to do the override in the calling JCL?
//PROC1 PROC
//STEP1 EXEC PGM=IEFBR14
//DD1 DD DSN=XYZ, DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
// PEND
//JJJ JCLLIB ORDER=PROCLIB PATH
//PROC2 PROC
//STEP2 EXEC PROC1
//JOBNAME JOB PARAMETERS
//JJJ JCLLIB ORDER=PROCLIB PATH
//PROC3 PROC
//STEP2.DD1 DSN=NEW NAME,DISP=SHR
THIS IS D WAY....
THIS PROG. WILL DO NOTHING IT'S JUST AN EXAMPLE
//STEP1 EXEC PGM=IEFBR14
//DD1 DD DSN=XYZ, DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
// PEND
//JJJ JCLLIB ORDER=PROCLIB PATH
//PROC2 PROC
//STEP2 EXEC PROC1
//JOBNAME JOB PARAMETERS
//JJJ JCLLIB ORDER=PROCLIB PATH
//PROC3 PROC
//STEP2.DD1 DSN=NEW NAME,DISP=SHR
THIS IS D WAY....
THIS PROG. WILL DO NOTHING IT'S JUST AN EXAMPLE
10 :: if a pic 9(3) value 354,b pic x(2) value 46 then
a)a>b
2)a<b
3)error
As picture clause for variable b is x(2), which means that
it can accept both numeric and characters of length 2, but
the care we should take here is that we should enclose them
in the single quotes, therefore to my expectation option b
is write.
it can accept both numeric and characters of length 2, but
the care we should take here is that we should enclose them
in the single quotes, therefore to my expectation option b
is write.