Skip and select records from file

We can use SORT to select records from input file to output file. The following JCL can be used for skipping some records from the input file (10 in the example) and then selecting a particular number of records (100 in the example) to the output file.













The below code is present in the above screenshot.

//SORTJCL# JOB (NXYZ),'SORT',NOTIFY=&SYSUID,CLASS=0,MSGCLASS=5
//***************************************************************
//* SORT JOB TO SKIP SOME RECORDS AND THEN SELECT SOME RECORDS  
//***************************************************************
//JS0100   EXEC PGM=SORT
//SORTIN   DD DISP=SHR,DSN=Input File Name,
//SORTOUT  DD DSN=Output File Name,
//         DISP=(NEW,CATLG,DELETE),
//         SPACE=(CYLS,(100,40),RLSE),
//         DATACLAS=DCTCOM,VOL=(,,,24)
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *
 OPTION COPY,SKIPREC=10,STOPAFT=100                       
/*

No comments: