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 - need to arrange records in groups - help!

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

New User


Joined: 01 Jul 2010
Posts: 10
Location: UK

PostPosted: Thu Jul 01, 2010 4:27 am    Post subject: Syncsort - need to arrange records in groups - help!
Reply with quote

Hi everybody,

my sample i/p file:
INPUT:
------
20XXXX111123456AABB01...
30XXXX111123456AABB01...
40XXXX111123456AABB01....
20XXXX111123456BBCC02...
30XXXX111123456BBCC02...
40XXXX111123456BBCC02....
10xxxx111123456GHYTUKJJND...
20XXXX222234567AABB01...
30XXXX222234567AABB01...
40XXXX222234567AABB01....
20XXXX222234567CCDD02...
30XXXX222234567CCDD02...
40XXXX222234567CCDD02....
10xxxx222234567GHYTUKJJNd...

position 1,2 is the record identifier, for every record type of 10 there can be multiple (20,30,40) record for it.
text in yellow can be random. 10 is something like a header record for the group
sample OUTPUT:
--------------------
10xxxx111123456GHYTUKJJND...
20XXXX111123456AABB01...
30XXXX111123456AABB01...
40XXXX111123456AABB01....
20XXXX111123456BBCC02...
30XXXX111123456BBCC02...
40XXXX111123456BBCC02....
10xxxx222234567GHYTUKJJND...
20XXXX222234567AABB01...
30XXXX222234567AABB01...
40XXXX222234567AABB01....
20XXXX222234567CCDD02...
30XXXX222234567CCDD02...
40XXXX222234567CCDD02....

could be simple to u guys..but am not able to find the answer.
let know if above post is not clear or require further info..Thanks

Edited
Back to top
View user's profile Send private message

subha m

New User


Joined: 01 Jul 2010
Posts: 10
Location: UK

PostPosted: Thu Jul 01, 2010 4:30 am    Post subject:
Reply with quote

Its a VB file, LRECL=900
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 01, 2010 4:33 am    Post subject: Reply to: need to arrange records in groups usinf DFsort- he
Reply with quote

subha m,

Your post is confusing at best. Please don't put colors and definitely Not yellow color.

From what I see is that your 10 record is at the bottom of 20,30,40 records and all you need is to bring it to the top as the first record? and leave the other records as is?

Is that it or something else?
Back to top
View user's profile Send private message
subha m

New User


Joined: 01 Jul 2010
Posts: 10
Location: UK

PostPosted: Thu Jul 01, 2010 9:08 pm    Post subject: Reply to: need to arrange records in groups usinf DFsort- he
Reply with quote

Sorry to be confusing and the color, yes, need to bring the 10 record to the top of the group
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jul 01, 2010 9:41 pm    Post subject:
Reply with quote

subha m,

Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD DSN=Your input VB file,DISP=SHR
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                     
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,16X,5)),                   
  IFTHEN=(WHEN=GROUP,END=(21,2,ZD,EQ,10),PUSH=(5:ID=8,SEQ=8)),   
  IFTHEN=(WHEN=(21,2,ZD,EQ,10),OVERLAY=(13:8C'0'))               
  SORT FIELDS=(5,16,CH,A)                                       
  OUTREC BUILD=(1,4,21)                                         
//*
Back to top
View user's profile Send private message
subha m

New User


Joined: 01 Jul 2010
Posts: 10
Location: UK

PostPosted: Fri Jul 02, 2010 12:11 am    Post subject: Reply to: need to arrange records in groups usinf DFsort- he
Reply with quote

Thanks Skolusu for your valuable help and time ..
But they seem to be using syncsort here and its not working for me icon_redface.gif Sorry for wasting ur efforts.
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 Jul 02, 2010 12:18 am    Post subject:
Reply with quote

Hello and welcome to the forum,

If your system uses the current release of Syncsort, i believe the code will work. Which release of Syncsort is being used?

Post all of the informational/diagnostic output from the run.
Back to top
View user's profile Send private message
subha m

New User


Joined: 01 Jul 2010
Posts: 10
Location: UK

PostPosted: Fri Jul 02, 2010 2:01 am    Post subject:
Reply with quote

my system uses syncsort 1.3.0, this doesnt seem to support..this doesnt seem to support GROUP . sorry am away from system, will try to post the exact msg later
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Jul 02, 2010 10:44 am    Post subject:
Reply with quote

Hello Subha,

As pointed above, the WHEN=GROUP function is supported by the latest release of SyncSort which is SyncSort for z/OS Release 1.3.2. You said a 'Group' ends with a '10' record. Does a 'Group' always start with a '20' record?
Back to top
View user's profile Send private message
subha m

New User


Joined: 01 Jul 2010
Posts: 10
Location: UK

PostPosted: Fri Jul 02, 2010 2:14 pm    Post subject:
Reply with quote

Code:
SYNCSORT FOR Z/OS  1.3.0.2R    U.S. PATENTS: 4210961, 5117495   (C) 2007 SYNCSO
 SORTPARM :                                                               
 SYSIN :                                                                   
   INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,16X,5)),                             
   IFTHEN=(WHEN=GROUP,END=(21,2,ZD,EQ,10),PUSH=(5:ID=8,SEQ=8)),           
                *                                                         
   IFTHEN=(WHEN=(21,2,ZD,EQ,10),OVERLAY=(13:8C'0'))                       
   SORT FIELDS=(5,16,CH,A)                                                 
   OUTREC BUILD=(1,4,21)                                                   
 WER268A  INREC STATEMENT   : SYNTAX ERROR                                 
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                             
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                             


This is the error message i am getting.
Yes, the 20,30,40 always are written in that order, I only need to bring the '10' record to the beginning of the group
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Jul 02, 2010 3:59 pm    Post subject:
Reply with quote

I know that this is probably a stupid question, but why not just sort the file to get the '10' records back in sequence?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Jul 02, 2010 4:05 pm    Post subject:
Reply with quote

Hi CG,

As per my understanding of the requirement, there are multiple '10' records and they should come at the beginning of each group. If we sort the data as such, all the '10' records will come at the top which is not what the TS wants.
Back to top
View user's profile Send private message
subha m

New User


Joined: 01 Jul 2010
Posts: 10
Location: UK

PostPosted: Fri Jul 02, 2010 4:20 pm    Post subject:
Reply with quote

Yes, thats correct..we need the '10' at the beginning of each group
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Jul 02, 2010 4:59 pm    Post subject:
Reply with quote

subha m,

Here's an untested piece of code which should work for your requirement. Try it and let us know.
Code:
 INREC IFTHEN=(WHEN=INIT,
               BUILD=(1,4,SEQNUM,8,ZD,16X,5)),
       IFTHEN=(WHEN=(29,2,ZD,EQ,10),
               OVERLAY=(13:SEQNUM,8,ZD,START=0)),
       IFTHEN=(WHEN=NONE,
               OVERLAY=(21:SEQNUM,8,ZD,
               13:5,8,ZD,SUB,21,8,ZD,M11,LENGTH=8))
 SORT FIELDS=(13,16,CH,A)
 OUTREC BUILD=(1,4,29)
Back to top
View user's profile Send private message
subha m

New User


Joined: 01 Jul 2010
Posts: 10
Location: UK

PostPosted: Fri Jul 02, 2010 5:28 pm    Post subject:
Reply with quote

Arun..It worked!!! Many Thanks icon_biggrin.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Sat Jul 03, 2010 3:15 pm    Post subject:
Reply with quote

You're welcome. Glad that it worked for you. icon_biggrin.gif
Back to top
View user's profile Send private message
subha m

New User


Joined: 01 Jul 2010
Posts: 10
Location: UK

PostPosted: Mon Jul 05, 2010 4:57 am    Post subject: Reply to: Syncsort - need to arrange records in groups - hel
Reply with quote

hi arun,

sorry to come back with some more questions. but
WHEN=INIT executes before other conditions, but can u pls explain the
BUILD=(1,4,SEQNUM,8,ZD,16X,5)), in the below code

INREC IFTHEN=(WHEN=INIT,
BUILD=(1,4,SEQNUM,8,ZD,16X,5)),
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Mon Jul 05, 2010 11:39 am    Post subject:
Reply with quote

subha m,

16X - leaves 16 spaces starting at pos-13, which is later on used to place sequence numbers in the subsequent IFTHEN conditions. The sequence numbers are padded in the beginning in order to 'GROUP' records.
5- Places the data portion of the VB record which starts at pos-5, Since length of a VB record is variable, you need not mention the length information
Back to top
View user's profile Send private message
subha m

New User


Joined: 01 Jul 2010
Posts: 10
Location: UK

PostPosted: Mon Jul 05, 2010 4:25 pm    Post subject: Reply to: Syncsort - need to arrange records in groups - hel
Reply with quote

Is it 16 spaces starting at position13, Where do we specify the starting position as 13? Did i miss something?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Mon Jul 05, 2010 5:08 pm    Post subject:
Reply with quote

Quote:
BUILD=(1,4,SEQNUM,8,ZD,16X,5)
You don't need to specify the output position unless you need to place it explicitly at some position. Here the first 12 bytes are already occupied by the RDW and Sequence number, hence it's quite obvious that next output postion is 13. Do you have a SyncSort manual? If you dont have one, request one from SyncSort Support or Contact/Send a PM to Alissa Margulies(JCL Moderator). They'll help you in getting you one soon.
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 syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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