Suppose your program is reading a Sequential Vsam file. The
file contains 10 records. How will you code the JCL to read
only 2nd, 5th, 7th,and 10th record?



Suppose your program is reading a Sequential Vsam file. The file contains 10 records. How will you..

Answer / mahesh

Hope this will work

//SORTIN DD DSN=INPUTFILE,DISP=SHR
//SORTOF01 DD DSN=X.Y.OUTFILE1,DISP=SHR
//SORTOF02 DD DSN=X.Y.OUTFILE2,DISP=SHR
//SORTOF03 DD DSN=X.Y.OUTFILE3,DISP=SHR
//SORTOF04 DD DSN=X.Y.OUTFILE4,DISP=SHR
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=01,STARTREC=2,ENDREC=2
OUTFIL FILES=02,STARTREC=5,ENDREC=5
OUTFIL FILES=03,STARTREC=7,ENDREC=7
OUTFIL FILES=04,STARTREC=10,ENDREC=10
/*
//STEP2 EXEC PGM=SORT
//SORTIN DD DSN=X.Y.OUTFILE1,DISP=SHR
// DD DSN=X.Y.OUTFILE2,DISP=SHR
// DD DSN=X.Y.OUTFILE3,DISP=SHR
// DD DSN=X.Y.OUTFILE4,DISP=SHR
//SORTOUT DD DSN=X.Y.OUTFILE,DISP=SHR
//SYSIN DD *
SORT FIELDS=COPY
/*
Use X.Y.OUTFILE as input to your program , but in real time
it wont make sense

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More JCL Interview Questions

suppose i have 10 job steps and i want to execute only step 6.How to write?

6 Answers  


What is a GDG

4 Answers   IBM,


Max. No of DD statements in a job ?

4 Answers   CSI,


What is the function of the dd mgmtclas keyword in sms datasets?

0 Answers  


what is the purpose of coding class parameter in job statement?

0 Answers   IBM,






How can the submitting users racf authority be overridden in a job stream?

0 Answers  


Can a job have only steplib and no joblib ?

6 Answers  


Which COND paramter will u use to execute the step only if the previous step does not execute

3 Answers   BoA, HSBC,


i want to see the jobs in skeleton queue in diff region. (eg. 7 regions are running means , i want to see all the jobs in 7 regions which are in skel queue using 1 command)

1 Answers  


At what stage, operator can change the class and priority of a submitted job?

2 Answers  


There are a set of 10 files and a customer will be selecting random no of files(i.e they may be more than 2, may not be in the order).Sometimes he might just select one file or sometimes no files at all.How do you code a JCL for this? Is it possible to code just JCL alone for this problem?

9 Answers   Infosys,


if we have a job consist of two steps and each step calling a proc having 10 steps each then how many steps are counted only 2 or 22(10+10+1+1)? can we have more than 255 steps in a single job?

5 Answers   Accenture,


Categories