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

Unique sort situation....


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
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
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Apr 27, 2016 9:12 pm
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
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Apr 27, 2016 11:28 pm
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

Global Moderator


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

PostPosted: Thu Apr 28, 2016 10:42 am
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

Moderator Emeritus


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

PostPosted: Thu Apr 28, 2016 12:10 pm
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: 275
Location: Mumbai

PostPosted: Sat Apr 30, 2016 2:39 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top