IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort JCL to remove duplicate without changing order.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arindambanerjee

New User


Joined: 30 Jun 2007
Posts: 39
Location: India

PostPosted: Fri Aug 21, 2009 11:37 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Aug 21, 2009 12:24 pm
Reply with quote

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
View user's profile Send private message
arindambanerjee

New User


Joined: 30 Jun 2007
Posts: 39
Location: India

PostPosted: Fri Aug 21, 2009 12:35 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Aug 21, 2009 12:42 pm
Reply with quote

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
View user's profile Send private message
arindambanerjee

New User


Joined: 30 Jun 2007
Posts: 39
Location: India

PostPosted: Fri Aug 21, 2009 1:04 pm
Reply with quote

Thanks Arun...
But I am piqued to know if there are any other possibilities to do the same.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Aug 21, 2009 1:12 pm
Reply with quote

What do you mean by other possibilities

The solution given is so simple that even I understand how it is done
Back to top
View user's profile Send private message
arindambanerjee

New User


Joined: 30 Jun 2007
Posts: 39
Location: India

PostPosted: Fri Aug 21, 2009 2:04 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Aug 21, 2009 2:08 pm
Reply with quote

There probably are other ways of doing it, but probably none as fast and efficient as the sort solution shown.
Back to top
View user's profile Send private message
arindambanerjee

New User


Joined: 30 Jun 2007
Posts: 39
Location: India

PostPosted: Fri Aug 21, 2009 2:28 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Rotate partition-logical & physic... DB2 0
Search our Forums:

Back to Top