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
 

 

Syncsort Sorting problem

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

New User


Joined: 21 Aug 2006
Posts: 72

PostPosted: Wed Sep 22, 2010 9:14 am    Post subject: Syncsort Sorting problem
Reply with quote

Input file (sequential 240 bytes))
------------------------------
152020100729922
252020100729000000711920 300013400PHARMACY #00918
3000005064729431105673350201007262010072620100726193208030
452020100729000000711920 300013400000000000000000001000000
252020100729000000714724 300016700PHARMACY #00910
3000005065031191109237200201007282010072820100728193194542
452020100729000000714724 300013400000000000000000001000000
252020100729000001001267 300013400PHARMACY #00918
3000005065090521100563970201007282010072820100728193200107
3000005065090581200563970201007282010072820100728193200107
452020100729000001001267 300003997000000000000000002000000
55202010072992200008200000003960000014484880000000000

1 is the header record and 5 is the trailer.

We receive an input file with records as shown.

Byte 1 is the record type
Byte 26 to 34 is vendor number
Byte 47 to 49 is id

I want to sort the file in such a way that I get the below result. A batch starts when a new 2 is encountered. A batch is a combination of 2,3,4 record types. So in the example there are total 3 batches. I want to sort the file on vendor number and id such that the whole batch gets reorganized. i.e like in the input file, the 3rd batch start at record 8 but after sorting it starts from record 5.

152020100729922
252020100729000000711920 300013400PHARMACY #00918
3000005064729431105673350201007262010072620100726193208030
452020100729000000711920 300013400000000000000000001000000
252020100729000001001267 300013400PHARMACY #00918
3000005065090521100563970201007282010072820100728193200107
3000005065090581200563970201007282010072820100728193200107
452020100729000001001267 300003997000000000000000002000000
252020100729000000714724 300016700PHARMACY #00910
3000005065031191109237200201007282010072820100728193194542
452020100729000000714724 300013400000000000000000001000000
55202010072992200008200000003960000014484880000000000

Is there any way for achieving this using syncsort? GROUP and PUSH functions are not recognized by the syncsort version we have.
Back to top
View user's profile Send private message

baljinders

New User


Joined: 21 Aug 2006
Posts: 72

PostPosted: Thu Sep 23, 2010 5:05 am    Post subject:
Reply with quote

anybody with any ideas on how to go about it ??
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: Thu Sep 23, 2010 5:29 am    Post subject:
Reply with quote

Hello,

Then i believe you have 2 "things to do":

One - start whatever action is needed to get the current release of Syncsort installed/available.

Two - implement this using your programming language. It will be rather straightforward to build a sortkey to append to each record and then sort the file by this key. Then use the re-arranged file as needed.
Back to top
View user's profile Send private message
prahalad

New User


Joined: 14 Sep 2010
Posts: 18
Location: Pune

PostPosted: Thu Sep 23, 2010 12:38 pm    Post subject:
Reply with quote

You can do it using sort. Please use the following code for this.

Code:

 INREC IFTHEN=(WHEN=INIT,BUILD=(1,240,C'000000000000')),               
       IFTHEN=(WHEN=GROUP,BEGIN=(1,1,ZD,EQ,2),PUSH=(241:26,9,47,3)),   
       IFTHEN=(WHEN=(1,1,ZD,EQ,1),BUILD=(1,240,C'000000000000')),     
       IFTHEN=(WHEN=(1,1,ZD,EQ,5),BUILD=(1,240,C'999999999999'))       
 OPTION EQUALS                                                         
 SORT FIELDS=(241,12,CH,A)                                             
 OUTFIL BUILD=(1,240)   


Hope this will work.
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: Thu Sep 23, 2010 7:14 pm    Post subject:
Reply with quote

Hello,

Which part of "GROUP and PUSH functions are not recognized by the syncsort version we have" was not clear?.

When posting a "solution" care must be taken that the solution can be used by the person who made the request. . .
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Fri Sep 24, 2010 5:25 pm    Post subject: Reply to: Syncsort Sorting problem
Reply with quote

baljinders,

Since you dont have the latest Syncsort release, the below SYNCTOOL job might be of help.
Code:
//STEP1  EXEC PGM=SYNCTOOL                                           
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                                     
//IN       DD DSN=Input file  ---->FB/LRECL=240
//T1       DD DSN=&T1,DISP=(,PASS),UNIT=SYSDA
//OUT      DD DSN=Output file ---->FB/LRECL=240
//TOOLIN   DD *
  SPLICE FROM(IN) TO(T1) ON(241,8,CH) WITHALL WITH(1,240) KEEPNODUPS -
  KEEPBASE USING(CTL1)
  SORT   FROM(T1) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(241:SEQNUM,8,ZD,257:12C'0')),
       IFTHEN=(WHEN=(1,1,ZD,EQ,2),
       OVERLAY=(241:SEQNUM,8,ZD,257:26,9,47,3)),
       IFTHEN=(WHEN=(1,1,ZD,EQ,5),
       OVERLAY=(257:12C'9')),
       IFTHEN=(WHEN=NONE,
       OVERLAY=(249:SEQNUM,8,ZD,241:249,8,ZD,SUB,241,8,ZD,M11,LENGTH=8))
//CTL2CNTL DD *
 SORT FIELDS=(257,12,CH,A)
 OUTFIL BUILD=(1,240)
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 Sep 24, 2010 7:58 pm    Post subject: Reply to: Syncsort Sorting problem
Reply with quote

Thanks Arun icon_smile.gif

I had hopes that you might see this topic icon_wink.gif

Have a great weekend,

d
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Sun Sep 26, 2010 2:02 am    Post subject: Reply to: Syncsort Sorting problem
Reply with quote

Hi Dick, You're welcome. And I wish you the same icon_smile.gif

I was away from the forums for a while. icon_sad.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 Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm


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