SORT JCL with INCLUDE
SORT JCL with INCLUDE
If you wish to copy only certain records which match a specific criteria.(Using INCLUDE)
SORT FIELDS=COPY
INCLUDE COND=((34,2,CH,EQ,C'AB'),AND,(74,1,CH,EQ,C' '))
The above SORT card will copy records which have 'AB' at 34th position and have spaces at 74th position.
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=((34,2,CH,EQ,C'AB'),AND,(74,1,CH,EQ,C' '))
/*
//*
Comments
Anonymous
Wed, 11/21/2012 - 10:49
Permalink
How to Search for a string?
If I dont know the position of a string and I need to extract all lines which contains the string.. Is it possible to do through sort?
Anonymous
Mon, 01/07/2013 - 10:30
Permalink
How to Search for a string?
Anonymous - 11/21/2012 - 10:49
If I dont know the position of a string and I need to extract all lines which contains the string.. Is it possible to do through sort?
-
I have the same question, is this possible. ?
Anonymous
Sat, 11/24/2012 - 13:12
Permalink
Help needed to fetch two records and sort records horizontally
Hi,
I have a VB file
Organization . . . : PS
Record format . . . : VB
Record length . . . : 32566
Block size . . . . : 32570
The data length would not be consistent for each record and the maximum length of the record would be a maximum of 200 characters
Find below the sample doc
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXæ<000>Effective Dates%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/KB-CEB/ABCDEFG%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/COD-IC/IBSTEFFECTIVEDATES%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/COD-IC/IBSTEFFECTIVEDATES%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/COD-IC2/I.B.A. Effective Dates%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/COD-IC3/IBSTEFFECTIVEDATES%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/COD-IT/Effective Dates%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/CSED-2/ %19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/CSED-3/Effective Dates%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/CSED-5/IW;0001;247220;0;0;0;0;0;0;1%19
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/CSED-6/001468198%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/CSED-7/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/CSED-8/05044101%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/CSED-9/IB ST Effective Dates%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/CSED-11//001468198;0001;00001;000000%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/WING-AN/IBSTEFFECTIVEDATES%19
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/WING-AN2/IBSTEFFECTIVEDATES%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/WING-AN3/IBSTEFFECTIVEDATES%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/FIRST-PAGE/%19.
I want to have the information after COD-IC2 & COD-IT listed in a separate file horizontally
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/COD-IC2/I.B.A. Effective Dates%19.
CS-9/IW;0001;00247220;00000000;00000000;00000000;00000000;00000000;00000000;000XXXXXæ<000>/COD-IT/Effective Dates%19.
Below is the sample for your reference
IC2/I.B.A. Effective Dates%19. IT/Effective Dates%19.
IC2/I.B.A. T. XIII, Subt. 5, Ch. 554, UCC Acknowledgments%19. IT/CAD Acknowledgments%19.
IC2/I.B.A. Nonst. Kefs & Cannos%19. IT/Kefs & Cannos%19.
IC2/I.B.A. Nonst. Preamble%19. IT/Reaamble%19
IC2/I.B.A. Nonst. Art. 1, |¥1%19. IT/|¥ 1.·Rights of persons%19.
IC2/I.B.A. Nonst. Art. 1, |¥2%19. IT/|¥ 2.·Political power%19.
IC2/I.B.A. Nonst. Art. 1, |¥3%19. IT/|¥ 3.·Will power%19.
OR
I.B.A. Effective Dates%19. Effective Dates%19.
I.B.A. T. XIII, Subt. 5, Ch. 554, UCC Acknowledgments%19. CAD Acknowledgments%19.
I.B.A. Nonst. Kefs & Cannos%19. Kefs & Cannos%19.
I.B.A. Nonst. Preamble%19. Reaamble%19
I.B.A. Nonst. Art. 1, |¥1%19. |¥ 1.·Rights of persons%19
I.B.A. Nonst. Art. 1, |¥2%19. |¥ 2.·Political power%19.
I.B.A. Nonst. Art. 1, |¥3%19. |¥ 3.·Will power%19.
Due I need to use the input file twice to get the information "SRP.TEST.K1.B222.R12A.E1.V1.MASTER"
Now I have used
//SORT001 EXEC PGM=SORT
//*JOB TO EXTRACT ONLY FROM A PARTICULAR POSITION IN INPUT AND SEND TO /
//SORTIN DD DSN=SRP.TEST.K1.B222.R12A.E1.V1.MASTER,DISP=SHR
//SORTOUT DD DSN=SRP.TEST.IB.B222.R12A.E1.V1.SOR1,UNIT=DISK,
// SPACE=(CYL,(50,50),RLSE),
// DCB=(RECFM=VB,LRECL=32566,BLKSIZE=32570),
// DISP=(NEW,CATLG)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(96,7,CH,A)
OPTION VLSHRT,VLSCMP -
INCLUDE COND=(96,7,CH,EQ,C'COD-IC2')
OUTREC FIELDS=(01:1,4,05:5,1,100)
//SORT002 EXEC PGM=SORT
//*JOB TO EXTRACT ONLY FROM A PARTICULAR POSITION IN INPUT AND SEND TO /
//SORTIN DD DSN=SRP.TEST.K1.B222.R12A.E1.V1.MASTER,DISP=SHR
//SORTOUT DD DSN=SRP.TEST.IB.B222.R12A.E1.V1.SOR2,UNIT=DISK,
// SPACE=(CYL,(50,50),RLSE),
// DCB=(RECFM=VB,LRECL=32566,BLKSIZE=32570),
// DISP=(NEW,CATLG)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(96,6,CH,A)
OPTION VLSHRT,VLSCMP -
INCLUDE COND=(96,6,CH,EQ,C'COD-IT')
OUTREC FIELDS=(01:1,4,05:5,1,100)
At present the output has C which is in first position getting added for the 1st file
CIC2/I.B.A. Effective Dates%19.
Similar for file 2
CIT/Effective Dates%19.
How to create the sort step to create the desired output in a separate file as given below.
IC2/I.B.A. Effective Dates%19. IT/Effective Dates%19.
IC2/I.B.A. T. XIII, Subt. 5, Ch. 554, UCC Acknowledgments%19. IT/CAD Acknowledgments%19.
IC2/I.B.A. Nonst. Kefs & Cannos%19. IT/Kefs & Cannos%19.
IC2/I.B.A. Nonst. Preamble%19. IT/Reaamble%19
IC2/I.B.A. Nonst. Art. 1, |¥1%19. IT/|¥ 1.·Rights of persons%19.
IC2/I.B.A. Nonst. Art. 1, |¥2%19. IT/|¥ 2.·Political power%19.
IC2/I.B.A. Nonst. Art. 1, |¥3%19. IT/|¥ 3.·Will power%19.
OR
I.B.A. Effective Dates%19. Effective Dates%19.
I.B.A. T. XIII, Subt. 5, Ch. 554, UCC Acknowledgments%19. CAD Acknowledgments%19.
I.B.A. Nonst. Kefs & Cannos%19. Kefs & Cannos%19.
I.B.A. Nonst. Preamble%19. Reaamble%19
I.B.A. Nonst. Art. 1, |¥1%19. |¥ 1.·Rights of persons%19
I.B.A. Nonst. Art. 1, |¥2%19. |¥ 2.·Political power%19.
I.B.A. Nonst. Art. 1, |¥3%19. |¥ 3.·Will power%19.
DikDude
Tue, 11/27/2012 - 21:21
Permalink
select records by a particular "string"
Yes, read about the SS (substring) operator in your sort product documentation.