View previous topic :: View next topic
Author
Message
kaleelahamed New User Joined: 08 Jun 2006Posts: 45 Location: Trumbull, CT
Hi,
My Input File,
Code:
----+----1----+----2----+----3----+
G3A8420CFP478296..|G3A8420CFP478296
G3A8838FFS855437..?G3A3707FFS855437
G3G3835FFS595971...G3B4512FFS595971
G3!4512CC0W3000K..±G3B4512CC0W3000K
G3!4512CC0W3087K..±G3B4512CC0W3087K
G3!4512CC0W3320G..±G3B4512CC0W3320G
G3!4512CC0W3331G..±G3B4512CC0W3331G
G3B1013FFT161151...G3B2203FFT161151
Output File:
Code:
----+----1----+----2----+----3----+
G3A8420CFP478296..|G3A8420CFP478296
G3A8838FFS855437..?G3A3707FFS855437
G3B1013FFT161151...G3B2203FFT161151
In the output file created, it should not contain the records in which the 3rd AND 22nd COLUMN are different. Else the whole record should be copied in output file. The input file can have duplicates.
The input and output file LRECL is 35. The 3rd and 22nd position can hav special characters also.
Can this be done by DFSORT?
I believe we can get the output by using SPLICE option. Currently I am trying by level best to get the output using the SPLICE option in ICETOOL.
Can any one of please guide me to get the expected results?
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
I've assumed that the records are FB
Code:
//CONCAT DD DSN=&&TEMP01,DISP=(MOD,PASS,DELETE),
// SPACE=(TRK,(10,10),RLSE),
// RECFM=FB,LRECL=80
//CONCAT2 DD DSN=&&TEMP02,DISP=(MOD,PASS,DELETE),
// SPACE=(TRK,(10,10),RLSE),
// RECFM=FB,LRECL=80
//OUT DD SYSOUT=*
//TOOLIN DD *
*
COPY FROM(IN1) TO(CONCAT) USING(CPY1)
*
COPY FROM(IN1) TO(CONCAT) USING(CPY2)
*
SPLICE FROM(CONCAT) TO(CONCAT2) ON(37,1,CH) WITH(38,1)
*
COPY FROM(CONCAT2) TO(OUT) USING(CPY3)
/*
//CPY1CNTL DD *
OUTREC BUILD(1,35,X,3,1)
/*
//CPY2CNTL DD *
OUTREC BUILD(1,35,X,22,1,X)
/*
//CPY3CNTL DD *
OUTREC BUILD(1,35)
Result
Code:
G3!4512CC0W3000K..±G3B4512CC0W3000K
G3A8420CFP478296..|G3A8420CFP478296
G3B1013FFT161151...G3B2203FFT161151
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
kaleelahamed,
The below SORT job does what you asked for.
Code:
//STEP1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD DSN=your.input.file....>FB,LRECL=35
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(36:C'0')),
IFTHEN=(WHEN=(3,1,CH,NE,22,1,CH),OVERLAY=(36:C'1'))
OPTION COPY
OUTFIL OMIT=(36,1,CH,EQ,C'1'),BUILD=(1,35)
SORTOUT
Code:
G3A8420CFP478296..|G3A8420CFP478296
G3A8838FFS855437..?G3A3707FFS855437
G3B1013FFT161151...G3B2203FFT161151
expat,
The 3rd and 22nd characters in the first record of your output differ.
Thanks,
Arun
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
kaleelahamed,
It is a simple case of using an OMIT cond. expat and arcvns made it complicated. The following DFSORT JCL will give you the desired results
Code:
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
G3A8420CFP478296..|G3A8420CFP478296
G3A8838FFS855437..?G3A3707FFS855437
G3G3835FFS595971...G3B4512FFS595971
G3!4512CC0W3000K..±G3B4512CC0W3000K
G3!4512CC0W3087K..±G3B4512CC0W3087K
G3!4512CC0W3320G..±G3B4512CC0W3320G
G3!4512CC0W3331G..±G3B4512CC0W3331G
G3B1013FFT161151...G3B2203FFT161151
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OMIT COND=(3,1,CH,NE,22,1,CH)
/*
Hope this helps...
Cheers
Back to top
kaleelahamed New User Joined: 08 Jun 2006Posts: 45 Location: Trumbull, CT
Thanks Skolusu!
The solution perfectly works....
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
Thanks are echoed. This is a new syntax for me.
Thank you.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Quote:
This is a new syntax for me.
Really? This syntax has been part of DFSORT for decades. Perhaps you might want to go through "z/OS DFSORT: Getting Started" to see what else you're not aware of. You can find it at:
Use [URL] BBCode for External Links
Back to top
Please enable JavaScript!