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

Syncsort - need to arrange records in groups - help!


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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Jul 02, 2010 12:18 am
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
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: 2481
Location: @my desk

PostPosted: Fri Jul 02, 2010 10:44 am
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
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: 2146
Location: At my coffee table

PostPosted: Fri Jul 02, 2010 3:59 pm
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: 2481
Location: @my desk

PostPosted: Fri Jul 02, 2010 4:05 pm
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
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: 2481
Location: @my desk

PostPosted: Fri Jul 02, 2010 4:59 pm
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
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: 2481
Location: @my desk

PostPosted: Sat Jul 03, 2010 3:15 pm
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
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: 2481
Location: @my desk

PostPosted: Mon Jul 05, 2010 11:39 am
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
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: 2481
Location: @my desk

PostPosted: Mon Jul 05, 2010 5:08 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Syncsort help SYNCSORT 3
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SYNCSORT-DB2 interface SYNCSORT 0
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 5
Search our Forums:

Back to Top