split into FOUR files - Syncsort



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

split into FOUR files - Syncsort

Postby ranga_subham » Thu May 14, 2009 9:29 am

Hi,

We receive 3 sets of records usually but at times there can be more sets in an input file (The LRECL is 85 and RECFM is FB). Each set starts with a "011" and ends with "099". The objective is to split first 3 sets of records into 3 files so that each file can have 1 set of records and extra records, if any, should be put into a file. The ouput files also should be of same LRECL & RECFM. We use Syncsort v1.2.3.

Input:
011 PART19X ..X563484.... 20091009
012 PART19X ..Y8B7756.... 20091218
013 PART19X ..XU8C432.... 20090501
099 PART19X ..CBU9000.... 20080726
011 PART64U ..PRI0005.... 20090119
012 PART45B ..VEX6B90.... 20090205
099 PARTERR ..INVALID.... 20090101
011 PART98P ..HET8765.... 20090606
012 PART98P ..VOR9090.... 20090807
013 PART98P ..VOR9090.... 20090808
014 PART98P ..FIX8765.... 20091014
099 PART98P ..S5645GT.... 20090612
011 PART10A ..W9045XP.... 20091116
011 PART75G ..T040506.... 20090111


Output-1:
011 PART19X ..X563484.... 20091009
012 PART19X ..Y8B7756.... 20091218
013 PART19X ..XU8C432.... 20090501
099 PART19X ..CBU9000.... 20080726


Output-2:
011 PART64U ..PRI0005.... 20090119
012 PART45B ..VEX6B90.... 20090205
099 PARTERR ..INVALID.... 20090101


Output-3:
011 PART98P ..HET8765.... 20090606
012 PART98P ..VOR9090.... 20090807
013 PART98P ..VOR9090.... 20090808
014 PART98P ..FIX8765.... 20091014
099 PART98P ..S5645GT.... 20090612


Output-4:
011 PART10A ..W9045XP.... 20091116
011 PART75G ..T040506.... 20090111


Please help.

TIA.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: split into FOUR files - Syncsort

 

Re: split into FOUR files - Syncsort

Postby arcvns » Thu May 14, 2009 9:22 pm

ranga_subham,

The below SyncSort job (Untested) should work for your requirement. Let us know if you come across any issues.
Good luck.
//STEP1    EXEC PGM=SORT
//SYSOUT     DD SYSOUT=*
//SORTIN     DD DSN=Input file
//OUT1       DD DSN=Output file1
//OUT2       DD DSN=Output file2
//OUT3       DD DSN=Output file3
//OUT4       DD DSN=Output file4
//SYSIN      DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(86:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'011'),OVERLAY=(94:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
        OVERLAY=(102:SEQNUM,8,ZD,94:86,8,ZD,SUB,102,8,ZD,M11,LENGTH=8))
  SORT FIELDS=COPY
  OUTFIL FNAMES=OUT1,INCLUDE=(94,8,ZD,EQ,1),BUILD=(1,85)
  OUTFIL FNAMES=OUT2,INCLUDE=(94,8,ZD,EQ,2),BUILD=(1,85)
  OUTFIL FNAMES=OUT3,INCLUDE=(94,8,ZD,EQ,3),BUILD=(1,85)
  OUTFIL FNAMES=OUT4,SAVE,BUILD=(1,85)
Arun
User avatar
arcvns
 
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: split into FOUR files - Syncsort

Postby ranga_subham » Thu May 14, 2009 10:04 pm

Hi, Arun.

Thank you very much for the immediate help. It has given me the correct results :D

What changes would be required to the SORT card if I have to copy 1500 such sets of records into each file from an input file? The requirement is changed to have 7 output files (each file should hold 1500 sets of records) and 1 extra output file for remaining records. So, a total of 10500 sets of records should be there in all 7 output files.

Please help.

Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: split into FOUR files - Syncsort

Postby arcvns » Fri May 15, 2009 1:15 am

ranga_subham,

You're welcome. :)
The below job SyncSort job should work for your new requirement. I cant test this as I am away from office now.

//STEP1    EXEC PGM=SORT
//SYSOUT     DD SYSOUT=*
//SORTIN     DD DSN=Input file
//OUT1       DD DSN=Output file1
//OUT2       DD DSN=Output file2
//OUT3       DD DSN=Output file3
//OUT4       DD DSN=Output file4
//OUT5       DD DSN=Output file5
//OUT6       DD DSN=Output file6
//OUT7       DD DSN=Output file7
//OUT8       DD DSN=Output file8
//SYSIN      DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(86:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'011'),OVERLAY=(94:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
        OVERLAY=(102:SEQNUM,8,ZD,94:86,8,ZD,SUB,102,8,ZD,M11,LENGTH=8))
  SORT FIELDS=COPY
  OUTFIL FNAMES=OUT1,INCLUDE=(94,8,ZD,LE,1500),BUILD=(1,85)
  OUTFIL FNAMES=OUT2,INCLUDE=(94,8,ZD,GT,1500,AND,94,8,ZD,LE,3000),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT3,INCLUDE=(94,8,ZD,GT,3000,AND,94,8,ZD,LE,4500),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT4,INCLUDE=(94,8,ZD,GT,4500,AND,94,8,ZD,LE,6000),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT5,INCLUDE=(94,8,ZD,GT,6000,AND,94,8,ZD,LE,7500),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT6,INCLUDE=(94,8,ZD,GT,7500,AND,94,8,ZD,LE,9000),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT7,INCLUDE=(94,8,ZD,GT,9000,AND,94,8,ZD,LE,10500),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT8,SAVE,BUILD=(1,85)
Arun
User avatar
arcvns
 
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: split into FOUR files - Syncsort

Postby ranga_subham » Fri May 15, 2009 10:07 am

Hi, Arun.

Your code worked like a charm...... :D

Thank you a lot.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: split into FOUR files - Syncsort

Postby arcvns » Fri May 15, 2009 7:45 pm

You're welcome :)
Arun
User avatar
arcvns
 
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: split into FOUR files - Syncsort

Postby ranga_subham » Sat May 16, 2009 9:56 pm

Hi, Arun.

Say, we don't have the sequnce numbers at the beginning of each records but still want to copy 1500 sets of records into each file, how the SORT card needs to be altered?

Input Data:
PART19X ..X563484.... 20091009
PART19X ..Y8B7756.... 20091218
PART19X ..XU8C432.... 20090501
PART19X ..CBU9000.... 20080726
PART64U ..PRI0005.... 20090119
PART64U ..VEX6B90.... 20090205
PART64U ..INVALID.... 20090101
PART98P ..HET8765.... 20090606
PART98P ..VOR9090.... 20090807
PART98P ..VOR9090.... 20090808
PART98P ..FIX8765.... 20091014
PART98P ..S5645GT.... 20090612
PART10A ..W9045XP.... 20091116
PART75G ..T040506.... 20090111


Please suggest.

Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: split into FOUR files - Syncsort

Postby arcvns » Sun May 17, 2009 8:35 am

ranga_subham,

Earlier you defined a "set" of records as those enclosed within a "011" record and a "099" record. If you dont have these sequence numbers at the beginning of each record, how do you define a set now?
Arun
User avatar
arcvns
 
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: split into FOUR files - Syncsort

Postby ranga_subham » Sun May 17, 2009 7:07 pm

Hi, Arun.

A set of records have common key appearing at the beginning of each record. PART19X, PART64U and so on......

Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: split into FOUR files - Syncsort

Postby arcvns » Tue May 19, 2009 2:45 am

ranga_subham,

From the sample data posted, I have assumed the key for each group at pos 1-7 and the LRECL as 85.
I have slightly modified the above job as per your latest post. This is NOT tested, so try this and let us know the results, Good luck.
//SYSIN DD *
  INREC IFTHEN=(WHEN=INIT,
        OVERLAY=(86:SEQNUM,8,ZD,94:SEQNUM,8,ZD,RESTART=(1,7))),
        IFTHEN=(WHEN=(94,1,ZD,EQ,1),OVERLAY=(102:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
        OVERLAY=(110:SEQNUM,8,ZD,102:86,8,ZD,SUB,110,8,ZD,M11,LENGTH=8))
  SORT FIELDS=COPY
  OUTFIL FNAMES=OUT1,INCLUDE=(102,8,ZD,LE,1500),BUILD=(1,85)
  OUTFIL FNAMES=OUT2,INCLUDE=(102,8,ZD,GT,1500,AND,94,8,ZD,LE,3000),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT3,INCLUDE=(102,8,ZD,GT,3000,AND,94,8,ZD,LE,4500),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT4,INCLUDE=(102,8,ZD,GT,4500,AND,94,8,ZD,LE,6000),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT5,INCLUDE=(102,8,ZD,GT,6000,AND,94,8,ZD,LE,7500),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT6,INCLUDE=(102,8,ZD,GT,7500,AND,94,8,ZD,LE,9000),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT7,INCLUDE=(102,8,ZD,GT,9000,AND,94,8,ZD,LE,10500),
         BUILD=(1,85)
  OUTFIL FNAMES=OUT8,SAVE,BUILD=(1,85)
/*
Arun
User avatar
arcvns
 
Posts: 55
Joined: Sat Feb 28, 2009 12:36 am
Location: India
Has thanked: 0 time
Been thanked: 0 time

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post