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
 

 

Unique sort situation....

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
dbecker

New User


Joined: 23 Feb 2009
Posts: 11
Location: Jefferson City MO

PostPosted: Wed Apr 27, 2016 8:53 pm    Post subject: Unique sort situation....
Reply with quote

Here is what I need to do. First 4 bytes in file are M2## followed by a 13 byte numeric.
Example..
Code:
M2031111111111111
M2041111111111111
M2091111111111111
M2091111111111111
M2091111111111111
M2101111111111111
M2131111111111111
M2191111111111111
M2191111111111111
M2191111111111111
M2191111111111111
M2191111111111111
M2191111111111111
M2191111111111111
M2191111111111111
M2191111111111111
M2191111111111111
M2191111111111111
M2191111111111111
M2032222222222222
M2042222222222222
M2042222222222222
M2132222222222222
M2192222222222222
M2192222222222222
M2192222222222222
M2192222222222222
M2192222222222222
M2192222222222222
M2192222222222222
M2192222222222222
M2192222222222222
M2192222222222222

I need to be able to sort these records by the 13 byte numeric starting in column 5 and then sort by the first 4 bytes. Here is the kicker....I need the first 4 bytes sorted in order so that M201, then M202, then M203..etc etc.....BUT I need M204 to always be last and not after M203. I know one could modify the file and change all M204 in pos 1 - 4 to M299 and then sort and then change back to M204. I was hoping there would be a way to do this in a single shot using syncsort.....but I'm not coming up with anything in my search and reading.
Thanks.
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Apr 27, 2016 9:12 pm    Post subject:
Reply with quote

Quote:
I know one could modify the file and change all M204 in pos 1 - 4 to M299 and then sort and then change back to M204.

inrec change M204 to M299 -sort- outrec change back to M204
Back to top
View user's profile Send private message
dbecker

New User


Joined: 23 Feb 2009
Posts: 11
Location: Jefferson City MO

PostPosted: Wed Apr 27, 2016 9:40 pm    Post subject: Reply to: Unique sort situation....
Reply with quote

Could you elaborate.....would that be via the FINDREP command you are talking about?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Apr 27, 2016 11:28 pm    Post subject:
Reply with quote

Code:
//SORTIN DD *                                 
M2031111111111111                             
M2041111111111111                             
M2091111111111111                             
//SORTOUT DD SYSOUT=*                         
//SYSIN DD *                                   
   INREC FINDREP=(INOUT=(C'M204',C'M999'))     
  SORT FIELDS=(1,4,CH,A)                       
   OUTREC FINDREP=(INOUT=(C'M999',C'M204'))   
/*
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Apr 28, 2016 10:42 am    Post subject:
Reply with quote

FINDREP doesn't look to be a clean solution, for me at least.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Thu Apr 28, 2016 12:10 pm    Post subject: Reply to: Unique sort situation....
Reply with quote

The swap-in/swap-out is fine as long as the value being changed-to does not exist in the input data.

The FINDREP is... overly dramatic. Just simple IFTHEN=(WHEN=logicalexpression with OVERLAY.
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Sat Apr 30, 2016 2:39 pm    Post subject:
Reply with quote

I second Bill and pandora..

This can be easily achieved with IFTHEN and OVERLAY

Thanks and regards,
Chandan
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 -> SYNCSORT 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