>> SORT would be tricky to only write the header record once per file, and to 
>> resequence the records.

Michael,

Not really. There are ways to get around it.  Here is a sample job of writing 
to 2 files. You can expand that to ā€œnā€ number of files.

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
FILE-HEADER-01
  DATA REC01
  DATA REC02
  DATA REC04
  DATA REC05
  DATA REC06
FILE-HEADER-02
  DATA REC01
  DATA REC02
  DATA REC03
FILE-HEADER-01
  DATA REC07
  DATA REC08
  DATA REC09
//OUT01    DD SYSOUT=*
//OUT02    DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,
               BEGIN=(01,11,CH,EQ,C'FILE-HEADER'),
                PUSH=(81:13,02,01,80)),
        IFTHEN=(WHEN=(01,11,CH,EQ,C'FILE-HEADER'),
             OVERLAY=(81:82X))

  OUTFIL FNAMES=OUT01,REMOVECC,
  INCLUDE=(81,02,CH,EQ,C'01'),
  BUILD=(01,80),
  HEADER1=(83,80)

  OUTFIL FNAMES=OUT02,REMOVECC,
  INCLUDE=(81,02,CH,EQ,C'02'),
  BUILD=(01,80),
  HEADER1=(83,80)
/*


OUT01 file will have the following data.

FILE-HEADER-01
  DATA REC01
  DATA REC02
  DATA REC04
  DATA REC05
  DATA REC06
  DATA REC07
  DATA REC08
  DATA REC09

OUT02 file will have the following data.

FILE-HEADER-02
  DATA REC01
  DATA REC02
  DATA REC03


Thanks,
Kolusu
DFSORT Development
IBM Corporation



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to