Splitting Records to Files



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Splitting Records to Files

Postby meowmeow » Mon Nov 15, 2010 8:30 pm

Hello,

is there a possibility to specify a block of data to be captured for specific files using Syncsort?
Sample Input:
AA1
abcdefg
abcdefg
abcdefg
AA2
BB1
abcdefg
abcdefg
abcdefg
BB2
CC1
abcdefg
abcdefg
abcdefg
CC2

Output:
File1:
AA1
abcdefg
abcdefg
abcdefg
AA2

File2:
BB1
abcdefg
abcdefg
abcdefg
BB2

File3:
CC1
abcdefg
abcdefg
abcdefg
CC2

So the splitting really depends on the header and the trailer records... AA1 should match with AA2 and so on... All records between them must be captured...

Thanks in advance :)
meowmeow
 
Posts: 8
Joined: Thu Feb 18, 2010 5:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting Records to Files

Postby Alissa Margulies » Mon Nov 15, 2010 9:25 pm

Yes, this can be accomplished using WHEN=GROUP logic. Please see the example below:
//SORT1 EXEC PGM=SORT 
//SORTIN  DD *         
AA1                   
ABCDEFG               
ABCDEFG               
ABCDEFG               
AA2                   
BB1                   
ABCDEFG               
ABCDEFG               
ABCDEFG               
BB2                   
CC1                   
ABCDEFG               
ABCDEFG               
ABCDEFG               
CC2                   
//SORTOF01 DD DSN=AA.RECORDS
//SORTOF02 DD DSN=BB.RECORDS
//SORTOF03 DD DSN=CC.RECORDS
//SYSOUT   DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(3,1,ZD,EQ,1),END=(3,1,ZD,EQ,2),
  PUSH=(81:ID=1))                                               
  SORT FIELDS=COPY                                               
  OUTFIL FILES=01,INCLUDE=(81,1,ZD,EQ,1),BUILD=(1,80)           
  OUTFIL FILES=02,INCLUDE=(81,1,ZD,EQ,2),BUILD=(1,80)           
  OUTFIL FILES=03,INCLUDE=(81,1,ZD,EQ,3),BUILD=(1,80)           
/*                             
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Splitting Records to Files

Postby ManishT » Fri Feb 08, 2013 3:55 pm

Hi,

I am new to this forum. I have the same requirement as mentioned but the number of files may vary. e.g. this time I have to split the data in 11 files.

SORTIN:
AA1                           
ABCDEFG                       
ABCDEFG                       
ABCDEFG                       
AA2                           
BB1                           
ABCDEFG                       
ABCDEFG                       
ABCDEFG                       
BB2                           
CC1                           
ABCDEFG                       
ABCDEFG                       
ABCDEFG                       
CC2                           
DD1                           
ABCDEFG                       
ABCDEFG                       
ABCDEFG                       
DD2                           
...............
.............
................


Sort:
SYSIN :
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(3,1,ZD,EQ,1),END=(3,1,ZD,EQ,2),
  PUSH=(81:ID=1))
  SORT FIELDS=COPY
  OUTFIL FILES=01,INCLUDE=(81,1,ZD,EQ,1),BUILD=(1,80)                           
  OUTFIL FILES=02,INCLUDE=(81,1,ZD,EQ,2),BUILD=(1,80)                           
  OUTFIL FILES=03,INCLUDE=(81,1,ZD,EQ,3),BUILD=(1,80)                           
  OUTFIL FILES=04,INCLUDE=(81,1,ZD,EQ,4),BUILD=(1,80)                           
  OUTFIL FILES=05,INCLUDE=(81,1,ZD,EQ,5),BUILD=(1,80)                           
  OUTFIL FILES=06,INCLUDE=(81,1,ZD,EQ,6),BUILD=(1,80)                           
  OUTFIL FILES=07,INCLUDE=(81,1,ZD,EQ,7),BUILD=(1,80)                           
  OUTFIL FILES=08,INCLUDE=(81,1,ZD,EQ,8),BUILD=(1,80)                           
  OUTFIL FILES=09,INCLUDE=(81,1,ZD,EQ,9),BUILD=(1,80)                           
  OUTFIL FILES=10,INCLUDE=(81,2,ZD,EQ,10),BUILD=(1,80)                         
  OUTFIL FILES=11,INCLUDE=(81,2,ZD,EQ,11),BUILD=(1,80)                         
  /*                                                       
  *                                                       
WER275A  NO KEYWORDS FOUND ON CONTROL STATEMENT           
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000             

Please advice why I am getting this error.

Thanks,
ManishT

Code'd
ManishT
 
Posts: 3
Joined: Fri Feb 08, 2013 3:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting Records to Files

Postby bodatrinadh » Fri Feb 08, 2013 4:52 pm

Hi Manish,

Show us your complete SYSOUT...And also check your input file attributes..
Thanks
-3nadh
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times

Re: Splitting Records to Files

Postby ManishT » Fri Feb 08, 2013 5:14 pm

Hi,

This is the complete SYSOUT I have. Can you please tell me which specific information your are looking for. The I/P File is of EB, 80 Bytes.
ManishT
 
Posts: 3
Joined: Fri Feb 08, 2013 3:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting Records to Files

Postby enrico-sorichetti » Fri Feb 08, 2013 5:26 pm

This is the complete SYSOUT I have.


when posting code/jcl snippets it is NECESSARY to use the code tags,
they preserve the spacing and use a fixed pitch font so to make possible
to spot for wrong columns in the data

the following line is ( as the text tells is )
indented 10 chars
1234567890
but it does not show

and here the same with the code tags
          indented 10 chars
1234567890


usually You get that error because of starting the sort control statements in column 1 instead of column 2
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Splitting Records to Files

Postby ManishT » Fri Feb 08, 2013 5:39 pm

Hi Enrico,

Thanks for reply. The JCL I am using is:

//X0TNSORT JOB (1,1424618),SORT,CLASS=L,PRTY=1,                     
//         REGION=0M,MSGCLASS=M,NOTIFY=&SYSUID TYPRUN=SCAN           
/*ROUTE PRINT LOCAL                                                 
/*JOBPARM ROOM=242C                                                 
//*                                                                 
//SORT1 EXEC PGM=SORT                                               
//SORTIN  DD DSN=SYSPGRP.XMKT.CCI.CLEAR.TEST,VOL=SER=Y2VL1E,DISP=SHR,
//   UNIT=3390                                                       
//SORTOF01 DD DSN=SYSPGRP.XMKT.SORT01,                               
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE),             
//    DCB=(RECFM=FB,LRECL=80)                                       
//SORTOF02 DD DSN=SYSPGRP.XMKT.SORT02,                               
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE),             
//    DCB=(RECFM=FB,LRECL=80)                                       
//SORTOF03 DD DSN=SYSPGRP.XMKT.SORT03,                               
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE),             
//    DCB=(RECFM=FB,LRECL=80)                                       
//SORTOF04 DD DSN=SYSPGRP.XMKT.SORT04,                               
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE),             
//    DCB=(RECFM=FB,LRECL=80)                                       
//SORTOF05 DD DSN=SYSPGRP.XMKT.SORT05,                   
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE), 
//    DCB=(RECFM=FB,LRECL=80)                           
//SORTOF06 DD DSN=SYSPGRP.XMKT.SORT06,                   
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE), 
//    DCB=(RECFM=FB,LRECL=80)                           
//SORTOF07 DD DSN=SYSPGRP.XMKT.SORT07,                   
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE), 
//    DCB=(RECFM=FB,LRECL=80)                           
//SORTOF08 DD DSN=SYSPGRP.XMKT.SORT08,                   
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE), 
//    DCB=(RECFM=FB,LRECL=80)                           
//SORTOF09 DD DSN=SYSPGRP.XMKT.SORT09,                   
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE), 
//    DCB=(RECFM=FB,LRECL=80)                           
//SORTOF10 DD DSN=SYSPGRP.XMKT.SORT10,                   
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE), 
//    DCB=(RECFM=FB,LRECL=80)                           
//SORTOF11 DD DSN=SYSPGRP.XMKT.SORT11,                   
//    SPACE=(CYL,(10,20),RLSE),DISP=(NEW,CATLG,DELETE), 
//    DCB=(RECFM=FB,LRECL=80)                           
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(3,1,ZD,EQ,1),END=(3,1,ZD,EQ,2),
  PUSH=(81:ID=1))                                                 
  SORT FIELDS=COPY                                               
  OUTFIL FILES=01,INCLUDE=(81,1,ZD,EQ,1),BUILD=(1,80)             
  OUTFIL FILES=02,INCLUDE=(81,1,ZD,EQ,2),BUILD=(1,80)             
  OUTFIL FILES=03,INCLUDE=(81,1,ZD,EQ,3),BUILD=(1,80)             
  OUTFIL FILES=04,INCLUDE=(81,1,ZD,EQ,4),BUILD=(1,80)             
  OUTFIL FILES=05,INCLUDE=(81,1,ZD,EQ,5),BUILD=(1,80)             
  OUTFIL FILES=06,INCLUDE=(81,1,ZD,EQ,6),BUILD=(1,80)             
  OUTFIL FILES=07,INCLUDE=(81,1,ZD,EQ,7),BUILD=(1,80)             
  OUTFIL FILES=08,INCLUDE=(81,1,ZD,EQ,8),BUILD=(1,80)             
  OUTFIL FILES=09,INCLUDE=(81,1,ZD,EQ,9),BUILD=(1,80)             
  OUTFIL FILES=10,INCLUDE=(81,2,ZD,EQ,10),BUILD=(1,80)           
  OUTFIL FILES=11,INCLUDE=(81,2,ZD,EQ,11),BUILD=(1,80)           
  /*                                                             

I am sorry as I don't know how to add a window to scroll code. The SYSIN is starting from column 3 in the JCL.

Thanks,
MainshT
ManishT
 
Posts: 3
Joined: Fri Feb 08, 2013 3:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting Records to Files

Postby enrico-sorichetti » Fri Feb 08, 2013 6:07 pm

wasting time...
if You do not use the code tags we cannot tell the error

what is that You are incapable of doing ...

select some text like when cutting and pasting

and after the text has been highlighted click on the code button ???
:mrgreen:

but apart that why not try to put the SORT/COPY statement as the first control record ???
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: Splitting Records to Files

Postby NicC » Fri Feb 08, 2013 6:35 pm

If the code button is not visible then use thPOSTREPLY button instead of the Quick Reply button - or use the Quick Reply button and then the Full Editor button.

Also, new or not, there is no excuse for not reading and obeying the forum rules e.g. do not 'tail-gate' old topics.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Splitting Records to Files

Postby BillyBoyo » Fri Feb 08, 2013 7:52 pm

A good way to get an error like that from Sort is to have a line, prior to your SYSIN, which the system thinks is "data" so generates a SYSIN DD * card. It tells you this, if you can manage to find it in your messages output.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post