View previous topic :: View next topic
|
Author |
Message |
arindambanerjee
New User
Joined: 30 Jun 2007 Posts: 39 Location: India
|
|
|
|
Hi All,
Though the subject seeems to refer the very old discussion but I don't think its to be repetative.
I have to sort some records of LRECL 200,FB but I don't want to change the order of the file.
The sysin card that i have used in the JCL is :
//Sysin dd*
sort fields=(1,350,CH,A) -
sum fields=none
/*
In this case the duplicates are removed but the order of the output records are changing i.e. it is arranged in ascending order because of sort fields=(1,350,CH,A).
I want to have the record to be in same order as it is in the input(i.e. output records should be unsorted as it is in the sortin and the duplicates should be removed).
This is satisfying my requirement partially.
Can we discuss on this? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
arindambanerjee wrote: |
want to have the record to be in same order as it is in the input(i.e. output records should be unsorted as it is in the sortin and the duplicates should be removed |
Ketan Varhade,
OPTION EQUALS will retain the order of equally keyed records. But since you have a SORT FIELDS=(1,350,CH,A) the output file WILL be sorted on first 350 characters which is NOT what the OP wants here.
arindambanerjee,
Add a SEQNUM at the end of each record, remove duplicates and then sort it back using the SEQNUM. |
|
Back to top |
|
|
arindambanerjee
New User
Joined: 30 Jun 2007 Posts: 39 Location: India
|
|
|
|
Hi Arun,
As suggested by you:
Add a SEQNUM at the end of each record, remove duplicates and the sort it back using the SEQNUM.
Could you please explain me this one. Its not crystal clear to me what you have mentioned.
Thanks,
Arindam |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
arindambanerjee,
The below SYNCTOOL job does what you asked.
Code: |
//STEP1 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN= Input file -- FB/200
//T1 DD DSN=&&T1,DISP=(,PASS)
//OUT DD DSN= Output file -- FB/200
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(1,350,CH) FIRST USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
INREC OVERLAY=(201:SEQNUM,8,ZD)
//CTL2CNTL DD *
SORT FIELDS=(201,8,CH,A)
OUTREC BUILD=(1,200) |
|
|
Back to top |
|
|
arindambanerjee
New User
Joined: 30 Jun 2007 Posts: 39 Location: India
|
|
|
|
Thanks Arun...
But I am piqued to know if there are any other possibilities to do the same. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
What do you mean by other possibilities
The solution given is so simple that even I understand how it is done |
|
Back to top |
|
|
arindambanerjee
New User
Joined: 30 Jun 2007 Posts: 39 Location: India
|
|
|
|
Hi Expat,
I just want to know if there is any other possibility of doing it...
I have also understood the job...
Thanks!!! |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
There probably are other ways of doing it, but probably none as fast and efficient as the sort solution shown. |
|
Back to top |
|
|
arindambanerjee
New User
Joined: 30 Jun 2007 Posts: 39 Location: India
|
|
|
|
I am also pretty not sure if there is any other faster method of doing it. Thats why I asked this question to the forum... |
|
Back to top |
|
|
|