View previous topic :: View next topic
Author
Message
Raghuraman_New New User Joined: 03 Oct 2008Posts: 43 Location: Chennai,India.
Hi,
Input:
AACBBC ABC
AAC000 ABC
AAC000
AAC000
AAC000 DEF
AAC000 DEF
ABA001
ABA001 DEF
ABA002 DEF
ABA002
Output :
AACBBC ABC
AAC000 ABC
AAC000
AAC000
AAC000 DEF
AAC001 DEF
ABA002 DEF
In the above example
Consider in the Coloumn 3 .
For any row , if we have the code DEF , that row shuld not be repeated(only one instance shuld be present)
For any other codes , the row shuld be processed as such.
Please help me in solving this out using Sort.
Note:
REFM : FB
LREC : 80
Thanks.
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
Hi,
if this is a sequential file then there is no such thing as rows, just records.
These output records are not mentioned in the input file unless I'm missing something
Code:
AAC001 DEF
ABA002 DEF
Gerry
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 496 Location: USA
Raghuram,
Your requirements are not clear. Here is a SyncSort for z/OS job that will produce the output below.
Code:
//SORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD DISP=(NEW,PASS),DSN=&&TEMP
//SORTIN DD *
AACBBC ABC
AAC000 ABC
AAC000
AAC000
AAC000 DEF
AAC000 DEF
ABA001
ABA001 DEF
ABA002 DEF
ABA002
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(80:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(8,3,CH,NE,C'DEF'),OVERLAY=(88:SEQNUM,8,ZD))
SORT FIELDS=(1,6,CH,A,88,8,CH,A)
SUM FIELDS=NONE
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=&&TEMP
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(80,8,CH,A)
OUTREC FIELDS=(1,80)
/*
Output produced:
Code:
AACBBC ABC
AAC000 ABC
AAC000
AAC000
AAC000 DEF
ABA001
ABA001 DEF
ABA002 DEF
ABA002
The only record removed is
If this is not what you want, then please be more specific in your description.
Back to top
sril.krishy Active User Joined: 30 Jul 2005Posts: 183 Location: hyderabad
Hi,
Here is the another way of getting the outut as shown by Alissa thru
SYNCSORT FOR Z/OS 1.3.0.2RI.
Code:
//PS020 EXEC PGM=SYNCTOOL
//SYSOUT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AACBBC ABC
AAC000 ABC
AAC000
AAC000
AAC000 DEF
AAC000 DEF
ABA001
ABA001 DEF
ABA002 DEF
ABA002
//OUT DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN) TO(OUT) USING(CTL1)
//CTL1CNTL DD *
OPTION COPY
INREC OVERLAY=(11:SEQNUM,3,ZD,RESTART=(1,10))
OUTFIL FNAMES=OUT,
OUTREC=(1,10),OMIT=(8,3,CH,EQ,C'DEF',AND,11,3,ZD,GE,002)
/*
Thanks
Krishy
Back to top
Please enable JavaScript!