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
 

 

Tricky sort logic required

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
pgopi92

New User


Joined: 29 Oct 2014
Posts: 3
Location: india

PostPosted: Mon Jan 25, 2016 3:29 pm    Post subject: Tricky sort logic required
Reply with quote

Hi Friends,

In want sort card which meets the below condition.

Input file:
Code:
3777345820160121123819HDR   
3777345820160121123819SHP011
3777345820160121123819SHPA21
3777345820160121123819SHP031
3777345820160121123819SHP038
3777345820160121123819SHP0AA
3777348020160121124214HDR   
3777348020160121124214SHP042
3777348020160121124214SHPA48
3777348020160121124214SHP011
3777348020160121124214SHP031


In input file many HDR records would be present followed by detail records (SHP) here my requirement would be
1) I Just want to sort detail records that to last field i.e 031 should come first rest detail records i don't care. As like below output file

output file would be like this:
Code:
3777345820160121123819HDR   
3777345820160121123819SHP031
3777345820160121123819SHPA21
3777345820160121123819SHP0AA
3777345820160121123819SHP011
3777345820160121123819SHP038
3777348020160121124214HDR   
3777348020160121124214SHP031
3777348020160121124214SHPA48
3777348020160121124214SHP011
3777348020160121124214SHP042


Appreciate you help.

Code'd and de-emphasised
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7272

PostPosted: Mon Jan 25, 2016 3:51 pm    Post subject: Reply to: Tricky sort logic required
Reply with quote

It's not tricky at all. You need a three-byte temporary extension to each record, which will contain your minor sort-key. Since you don't care about the order of the other records, you can just set this minor-sort key to the value with WHEN=INIT, and use WHEN=(logicalexpression) to test for 031 and set it to, for instance, X'000000'.

Sort on your key, followed by minor key. In OUTREC or OUTFIL return record to original size.
Back to top
View user's profile Send private message
pgopi92

New User


Joined: 29 Oct 2014
Posts: 3
Location: india

PostPosted: Mon Jan 25, 2016 5:16 pm    Post subject:
Reply with quote

Hi Bill,

Thanks much for your advise,

It would be more grateful if you provide the sort card.
Back to top
View user's profile Send private message
pgopi92

New User


Joined: 29 Oct 2014
Posts: 3
Location: india

PostPosted: Mon Jan 25, 2016 5:47 pm    Post subject:
Reply with quote

Thank much Bill,

I have done with the help of yours...

INREC IFTHEN=(WHEN=INIT,
OVERLAY=(2679:C'C')),
IFTHEN=(WHEN=(631,3,CH,EQ,C'031'),
OVERLAY=(2679:C'B')),
IFTHEN=(WHEN=(023,3,CH,EQ,C'HDR'),
OVERLAY=(2679:C'A'))
SORT FIELDS=(26,5,A,1,8,A,9,14,D,2548,6,A,2585,7,A,2679,1,A),
FORMAT=CH,EQUALS
OUTREC BUILD=(1:1,2679)

Thank you soooo much for you advise.. icon_biggrin.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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need help in building a logic Benchwarmer All Other Mainframe Topics 3 Wed Feb 22, 2017 2:49 am
No new posts JCL sort Match and NoMatch rakeshsekar1987 SYNCSORT 2 Thu Feb 02, 2017 10:26 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am
No new posts Sort Card to Remove Duplicate records... raj4neo SYNCSORT 2 Wed Jan 25, 2017 4:44 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


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