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

What are steplib and joblib?

0 Answers  


How can unused space allocation be returned to the system when a dataset is closed?

0 Answers  


what is the use of temporary files?

5 Answers   Hexaware,


is there any possibilities for sumbitting more than one job in single jcl? if yes...based on which thing they will execute..(priority,class,time,written order..?)

3 Answers   HSBC,


Suppose there are 10 steps in a PROC, I want to execute only step5. How do you give the condition in the JCL that calls this PROC?

3 Answers   IBM,






i have records from 1 t0 100 . i need to open records from 10 to 18 and change the values in tht ? how can i do tht ?

2 Answers   Syntel,


I want to join to input files and write the matching fields on to an output file but i dont want the output file a sorted one

0 Answers  


How does -818 sql error occur? Why does it happen and what can be done to overcome this error code?

5 Answers   RBS,


What is the significance of addrspc parameter in exec statement?

0 Answers  


What is a Proc ? why do we go for a Proc ? What are the types of procs?Can we have nesting in Procs ?

9 Answers   Xansa,


i just need the first and last record from a sequencial file?how

2 Answers  


A statement about PROCs is " In PROCs, Symbolic Parameters can be assigned on PROC and EXEC", BUT On which EXEC, (i) On the JCL's EXEC which is calling to PROC1. (Inside JCL, EXEC PROC1) (ii) or On the PROC's EXEC where it calls the PGM1. (Inside PROC, EXEC PGM=PGM1)

2 Answers   IBM,


Categories