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

Need advice on sort card


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 32
Location: India

PostPosted: Thu Apr 04, 2013 1:00 pm
Reply with quote

Hi,

I need a sort card to eliminate duplicates in different scenario.
Assuming input file holds below values

Input:
AAA
AAA
BBB
CCC
CCC

Output:
BBB
The output file must hold only the unique value BBB alone.
Is there any option to achive this in Sort card?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 04, 2013 1:12 pm
Reply with quote

Do you need to sort the data, or is it already sorted?

Are you able to use SyncTool (often "aliased" as ICETOOL). If so, you can look at the SELECT operator.
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 32
Location: India

PostPosted: Thu Apr 04, 2013 1:36 pm
Reply with quote

Hi Bill,

Data will be sorted in previous step, Actually the data will be present in two input files. so data will be concatinated and sorted to bring it to single file.

It would be fine if option present in ICETOOL and will it be possible to sort in the same step of the above query. Thanks
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 04, 2013 1:50 pm
Reply with quote

Well, SELECT with NODUPS should do you, with USING(xxxx) and an xxxxCNTL with OPTION COPY.

If there is an earlier step simply to sort the file for this process, that can be included in the same step, with the removal of the USING (by default, the data will be sorted on the ON values).
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 32
Location: India

PostPosted: Thu Apr 04, 2013 2:32 pm
Reply with quote

Hi Bill,

Oh Great! Can I have a sample syntax to achive this. Thanks...
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 04, 2013 2:33 pm
Reply with quote

Also, if your SyncSort is current, look at this to see what to look at in your manual for another way to do it conveniently.
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 32
Location: India

PostPosted: Thu Apr 04, 2013 3:26 pm
Reply with quote

Hi Bill,

I think the provided information would be sufficient for me.
Great! Thanks for help bill.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 04, 2013 3:51 pm
Reply with quote

No problem. Thanks for letting us know.

It is lucky, as I completely missed that you wanted more, as our messages "crossed in the post" as it were.
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Thu Apr 04, 2013 6:37 pm
Reply with quote

Hi Senthil,

You can use below code -

Code:
//STEP2    EXEC PGM=ICETOOL                         
//DFSMSG   DD  SYSOUT=*                             
//TOOLMSG  DD  SYSOUT=*                             
//IN01     DD  *                                     
AAA                                                 
BBB                                                 
AAA                                                 
CCC                                                 
CCC                                                 
//OUT01    DD  SYSOUT=*                             
//TOOLIN   DD  *                                     
   SELECT FROM(IN01) TO(OUT01) ON(01,03,CH) NODUPS   
//*   
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 04, 2013 6:53 pm
Reply with quote

Sandip,

The data is already sorted. As you have coded that, it will be sorted again, which is a waste of resources. You need USING(xxxxCNTL) and have OPTION COPY in the xxxxCNTL DD.
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Thu Apr 04, 2013 7:52 pm
Reply with quote

Oops my Bad. Thanks Bill for pointing out my mistake.
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 32
Location: India

PostPosted: Thu Apr 04, 2013 10:39 pm
Reply with quote

Hi Bill,

As per your suggestion, I tried and got my data sorted as expected. I have specified the syntax below since it might be useful for people referring.

//TOOLIN DD *
SELECT FROM(INPUT) TO(DUP) DISCARD(NODUP) -
ON(1,7,CH) ALLDUPS USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,7,CH,A)

Thanks again for lightning speed response. icon_biggrin.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 04, 2013 11:10 pm
Reply with quote

To confirm that you've now "merged" two tasks, which is the original sorting of the file and the de-duplication.

If you don't need the discarded data for anything, you can remove the DISCARD and its DD.

If you are doing the SORT in this step as well, you don't need to specify it in the CTL1CNTL, as it will be automatic for SELECT.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Apr 05, 2013 1:35 am
Reply with quote

Hello and welcome to the forum,

Will either of the 2 input files contain duplicates or are duplicates introduced when the 2 sets of data are combined?

If the 2 inpt files are only unique entries, you might consider JOINKEYS.
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 32
Location: India

PostPosted: Fri Apr 05, 2013 11:13 am
Reply with quote

Hi Bill,

Previously I had a sort step to merge the 2 files in sorted order to bring it to one file and eliminate the duplicate records. Now I have removed the previous sort step and achieved it in one step. Thanks

Also thanks for updating me that SELECT will do SORTING by default.

Hi Dick scherrer, Thanks for the invite. Eiter of the 2 files cannot have duplicates. only on merging they can have. So i have included sort in control cards. Thanks
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 32
Location: India

PostPosted: Fri Apr 05, 2013 11:15 am
Reply with quote

Hi Bill,

To add, I need both DUP & NODUP records. So I kept DISCARD as it is.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Apr 05, 2013 8:37 pm
Reply with quote

Hello,

Then i'd suggest you look at JOINKEYS - not only for this process, but others in the future. I believe there is more flexibility with a JOINKEYS icon_wink.gif
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 Help with SORT - I need to validate d... DFSORT/ICETOOL 7
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
Search our Forums:

Back to Top