Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Apr 23, 2004 6:20 pm Post subject:
It's not clear what you're really asking for.
Do you mean that every time the key changes, you want to write to another output data set? If the key changes 1000 times, do you want 1000 output data sets? What is the actual maximum number of unique keys you can have? Are you going to supply a DD statement for each possible output file, or do you want to dynamically allocate the output files as needed, or ? _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Yes that is the idea. But what I am planning to do is split the file based on a key and if the keys are more than certain number say 15 then I will create 15 + 1 file. i.e. 15 files based on the key and then 1 file with the remaining keys.
I can then feed the new file created back to the same sort card and continue.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Sat Apr 24, 2004 11:31 am Post subject:
Ok, let's assume your key is in positions 1-2, and that you will supply the 16 output DD statements needed. Here's a DFSORT job that will do what you want:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//CTL2CNTL DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
// DD *
OUTFIL FNAMES=OUT16,SAVE
//OUT01 DD DSN=... output file 1
...
//OUT16 DD DSN=... output file 16
//TOOLIN DD *
* For each of the first 15 unique keys, generate a
* control statement like this:
* OUTFIL FNAMES=OUTnn,INCLUDE=(1,2,CH,EQ,C'xx')
SELECT FROM(IN) TO(CTL2CNTL) ON(1,2,CH) FIRST USING(CTL1)
* Use the generated control statements plus
* OUTFIL FNAMES=OUT16,SAVE
* to split the input records to OUT01-OUT16.
COPY FROM(IN) USING(CTL2)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=CTL2CNTL,REMOVECC,ENDREC=15,
OUTREC=(C' OUTFIL FNAMES=OUT',SEQNUM,2,ZD,
C',INCLUDE=(1,2,CH,EQ,C''',1,2,C''')',80:X)
/*
If you wanted to get fancier, you could generate the OUTnn DD statements instead of hardcoding them and submit the entire job to the internal reader. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
I want to split the input file based on the particular field(rebate period). If the number of the rebate period is 6, means i have to move corresponding records to 6 files. The problem is i dont know the number of rebate periods in the file before processing.
Is it possible trhru JCL or COBOL
The firdt 2 bytes inticates the type of the record whether HD, TR & UD.
record length is 400 for all HD TR & UD
My input file looks like. Say 3 distinct rebate periods.
HD<-------------------------------some data-------------------->20000401
UD<--------------------------some difrent data------------------------------>
.
.
TR<--------------------------------some data--------------------->20000401
HD<----------------------------------------------------------------->20040101
UD
.
TR<----------------------------------------------------------------->20040101
HD<------------------------------------------------------------------>20020101
UD
.
.
TR--------------------------------------------------------------------20020101
The out put files look like
out1
HD<----------------------------------------------------------------->20040101
UD
.
TR<----------------------------------------------------------------->20040101
out 2
HD<------------------------------------------------------------------>20020101
UD
.
.
TR--------------------------------------------------------------------20020101
out 3
like
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Sun May 16, 2004 8:01 am Post subject:
Vishal,
The following DFSORT/ICETOOL JCl will give you the desired results. If you have syncsort at your shop then use synctool as pgm in step0100.The first step reads the input dataset and creates dynamic control cards and also output files. The step0200 then submits another job to intrdr which actually splits the file into 'n' number of output files. You need to put your tid or the highlevel qualifier in place of USERID
For your understanding as to how the job works, remove the statement in step0200
Code:
//SORTOUT DD SYSOUT=(*,INTRDR)
and replace it with
Code:
//SORTOUT DD SYSOUT=*
Now check your SYSOUT and make sure that the jcl looks right. If you are satisfied that the jcl is ok then code the INTRDR statement.
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Sun May 16, 2004 12:08 pm Post subject:
Frank,
Thanks for adding the option Equals parm. I always forget that because it is the installed default parm for our site. And I love to play with splice but unfortunately I can't. So I still have to go with good old binary zero sum trick
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum