SORT JCL to copy when location of matching data is not known
SORT JCL to copy when location of matching data is not known
If you wish to copy all the records which have a particular string in the file, but its location may vary or is not known
then you can use the following sort card
SORT FIELDS=COPYINCLUDE COND=(1,100,SS,EQ,C'ABC')
The above sort card will look for string 'ABC' anywhere between 1 to 100 bytes in the input file. You can specify the range
of cols (start and end) where the search is to be performed. If you are not sure about the range then you can give start position
as 1 and end pos as record length of the file.
Example JCL is provided below.
; ; ; ;
//SETP001 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//REPORT1 DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=USERID.ABC.INPFILE,
//SORTOUT DD DSN=USERID.ABC.OUTFILE,
// DISP=(,CATLG),
// SPACE=(TRK,(30,10),RLSE),
// UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0,DSORG=PS)
//SORTWK01 DD UNIT=DISK,SPACE=(CYL,(20,5),RLSE)
//SORTWK02 DD UNIT=DISK,SPACE=(CYL,(20,5),RLSE)
//SORTWK03 DD UNIT=DISK,SPACE=(CYL,(20,5),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,100,SS,EQ,C'ABC')
/*
//*
Comments
Anonymous
Fri, 03/08/2013 - 16:00
Permalink
Job failed with WER250A
I tried the above method but got an abend. The sysout indicate the following sort error
WER250A INCLUDE/OMIT FIELD BEYOND RECORD
The following change was required to fix the issue. VLSHRT command was included to fix it.
//SYSIN DD *
SORT FIELDS=COPY,VLSHRT
INCLUDE COND=(1,100,SS,EQ,C'ABC')
/*
VLSHRT specifies that records that are too short to contain all of the INCLUDE compare fields are not to be included in the output data set.
Anonymous
Sun, 04/21/2013 - 17:44
Permalink
What is 'SS' in the include statement
Hi all,
Any one of you please let me know what is 'SS' indicates in the include statement?