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

SYNCSORT Splitting the file based on check digit


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vissubhai

New User


Joined: 07 Nov 2007
Posts: 12
Location: Hyderabad

PostPosted: Wed Mar 19, 2008 7:49 pm
Reply with quote

Hi All..

I have a small requirement. I have different kinds of files with different record layouts. But the key for these files is present in the same location.(Starting 2 positions)

The key field is of 3 byte ZD field.

Now I want to split a file based on the following logic:
Divide the key field by 3 and based on the remainder move that record to the files accordingly.
That is if the remainder is 0, move the record to file1,
if remainder is 1, move the record to file 2 and
if remainder is 2, move the record to file 3.

Lets say for example my input file is a FB with LRECL=80 and the input records are as follows:

120AAAAAA
121ABCDEF
122BCDEFG
123UUUUUU
124IIIIIIIII
125QQQQQ

The three output files should be like:

Output 1
120AAAAAA
123UUUUUU

Output 2
121ABCDEF
124IIIIIIIII

Output 3
122BCDEFG
125QQQQQ

Also the same sort card should be used for other files with different record-lengths like FB with LRECL=8000 or 900 etc.

Please let me know if the requirement is not clear.

Vissubhai
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Mar 19, 2008 8:56 pm
Reply with quote

vissubhai,

SORTIN can consist of concatenated data sets, but if the data sets are fixed-length, they must all have the same LRECL.
Back to top
View user's profile Send private message
vissubhai

New User


Joined: 07 Nov 2007
Posts: 12
Location: Hyderabad

PostPosted: Wed Mar 19, 2008 9:20 pm
Reply with quote

Alissa,

My requirement is can I have only one sort card for different files.

SORTIN will have only One input file and will have SORTOF01, SORTOF02, SORTOF03 files with record length same as of input file.

That is I have different JCLs for different files but wanted to use the same sortcard for them.

Let me know if I am not clear.

Thanks,
Vissubhai
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Mar 19, 2008 9:58 pm
Reply with quote

With FB data, the LRECL needs to be coded accordingly in the inrec/outrec statements, as follows:
Code:

//STEP1  EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
120AAAAAA                                               
121ABCDEF                                               
122BCDEFG                                               
123UUUUUU                                               
124IIIIIIIII                                           
125QQQQQ 
//SORTOF01 DD DSN=OUTPUT.REMAIN0                       
//SORTOF02 DD DSN=OUTPUT.REMAIN1                       
//SORTOF03 DD DSN=OUTPUT.REMAIN2                       
//SYSIN DD  *                                           
    INREC FIELDS=(1,80,1,3,ZD,MOD,+3,M11,LENGTH=1)
    SORT FIELDS=COPY                                   
    OUTFIL FILES=01,INCLUDE=(81,1,ZD,EQ,0),OUTREC=(1,80)
    OUTFIL FILES=02,INCLUDE=(81,1,ZD,EQ,1),OUTREC=(1,80)
    OUTFIL FILES=03,INCLUDE=(81,1,ZD,EQ,2),OUTREC=(1,80)
/*


If your data were VB, then you could modify the job to standardize it for any LRECL:
Code:

//STEP1  EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=INPUT.VB,DISP=SHR
//SORTOF01 DD DSN=OUTPUT.REMAIN0                       
//SORTOF02 DD DSN=OUTPUT.REMAIN1                       
//SORTOF03 DD DSN=OUTPUT.REMAIN2                       
//SYSIN    DD *                                             
    INREC FIELDS=(1,4,5,3,ZD,MOD,+3,M11,LENGTH=1,5)       
    SORT FIELDS=COPY                                     
    OUTFIL FILES=01,INCLUDE=(5,1,ZD,EQ,0),OUTREC=(1,4,6) 
    OUTFIL FILES=02,INCLUDE=(5,1,ZD,EQ,1),OUTREC=(1,4,6) 
    OUTFIL FILES=03,INCLUDE=(5,1,ZD,EQ,2),OUTREC=(1,4,6) 
/*         
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Mar 19, 2008 10:32 pm
Reply with quote

Hello,

Quote:
My requirement is can I have only one sort card for different files.
This "requirement" needs to be changed to "My requirement is I can have only one sort card for different files of the same lrecl".

Possibly i misunderstand and this is only a "want" rather than an actual requirement. . .
Back to top
View user's profile Send private message
vissubhai

New User


Joined: 07 Nov 2007
Posts: 12
Location: Hyderabad

PostPosted: Thu Mar 20, 2008 9:19 am
Reply with quote

Thanks a lot Alissa...
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top