Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sort JCL to remove duplicate without changing order.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Sort JCL to remove duplicate without changing order.
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: 2285
Location: @my desk

PostPosted: Fri Aug 21, 2009 12:24 pm    Post subject:
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    Post subject: Reply to: Sort JCL to remove duplicate without changing orde
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: 2285
Location: @my desk

PostPosted: Fri Aug 21, 2009 12:42 pm    Post subject:
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    Post subject: Reply to: Sort JCL to remove duplicate without changing orde
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: 8593
Location: Back in jolly old England

PostPosted: Fri Aug 21, 2009 1:12 pm    Post subject:
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    Post subject: Reply to: Sort JCL to remove duplicate without changing orde
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: 8593
Location: Back in jolly old England

PostPosted: Fri Aug 21, 2009 2:08 pm    Post subject:
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    Post subject: Reply to: Sort JCL to remove duplicate without changing orde
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us