View previous topic :: View next topic
|
Author |
Message |
antonyjoseph
New User
Joined: 11 Apr 2007 Posts: 28 Location: India
|
|
|
|
I have a file which has 100,000 records where the first record is a header.
I need to split this file into two files at 50,000th records. but need the header on the second files also.
Can i do this on a single sort step. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you can try this
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=INPUT-FILE,DISP=SHR
//FILE1 DD DSN=OUTPUT-FILE1,DISP=(,CATLG,DELETE)
//FILE2 DD DSN=OUTPUT-FILE2,DISP=(MOD,CATLG,DELETE)
//TOOLIN DD *
COPY FROM(IN) TO(FILE1) USING(CTL1)
COPY FROM(IN) TO(FILE2) USING(CTL2)
COPY FROM(IN) TO(FILE2) USING(CTL3)
/*
//CTL1CNTL DD *
SORT FIELDS=COPY,STOPAFT=50000
/*
//CTL2CNTL DD *
SORT FIELDS=COPY,STOPAFT=1
/*
//CTL3CNTL DD *
SORT FIELDS=COPY,SKIPREC=50000
/* |
You can also look at the SUBSET operand but my version of DFSORT does not allow me to test it.
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
antonyjoseph,
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT1 DD DSN=... output file1
//OUT2 DD DSN=... output file2
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT1) INPUT KEEP FIRST(50000)
SUBSET FROM(IN) TO(OUT2) INPUT KEEP FIRST RRN(50001,*)
/*
|
|
|
Back to top |
|
|
|