Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need advice on sort card

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 28
Location: India

PostPosted: Thu Apr 04, 2013 1:00 pm    Post subject: Need advice on sort card
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Apr 04, 2013 1:12 pm    Post subject: Reply to: Need advice on sort card
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: 28
Location: India

PostPosted: Thu Apr 04, 2013 1:36 pm    Post subject: Need advie on sort card
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Apr 04, 2013 1:50 pm    Post subject: Reply to: Need advice on sort card
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: 28
Location: India

PostPosted: Thu Apr 04, 2013 2:32 pm    Post subject: Need advice on sort card
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Apr 04, 2013 2:33 pm    Post subject: Reply to: Need advice on sort card
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: 28
Location: India

PostPosted: Thu Apr 04, 2013 3:26 pm    Post subject: Need help on sort card
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Apr 04, 2013 3:51 pm    Post subject: Reply to: Need advice on sort card
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: 61
Location: pune

PostPosted: Thu Apr 04, 2013 6:37 pm    Post subject: Reply to: Need advice on sort card
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Apr 04, 2013 6:53 pm    Post subject: Reply to: Need advice on sort card
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: 61
Location: pune

PostPosted: Thu Apr 04, 2013 7:52 pm    Post subject: Reply to: Need advice on sort card
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: 28
Location: India

PostPosted: Thu Apr 04, 2013 10:39 pm    Post subject: Reply to: Need advice on sort card
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Apr 04, 2013 11:10 pm    Post subject: Reply to: Need advice on sort card
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

Site Director


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

PostPosted: Fri Apr 05, 2013 1:35 am    Post subject:
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: 28
Location: India

PostPosted: Fri Apr 05, 2013 11:13 am    Post subject: Reply to: Need advice on sort card
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: 28
Location: India

PostPosted: Fri Apr 05, 2013 11:15 am    Post subject: Need advice on SORT card.
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

Site Director


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

PostPosted: Fri Apr 05, 2013 8:37 pm    Post subject:
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    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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us