I need to create an o/p file with a key as first field and second field.The number of records to my o/p file should be 4 of the key.
the o/p should come as
_________________ 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
Frank,
thanks for u r reply.But my requirement is diffrent.
I need to have the o/p in my file as below.
02 1234
02 1234
02 1235
02 1235
02 1235
02 1236
03 1237
03 1237
03 1237
here the number of total recors are 9(with duplicates) but the actual records of the key are 4 only(ie.. 02 1234,02 1235,02 1236 and 03 1237.
suppose if i say i need to have the o/p file with key field of 3 then my o/p should look like,,
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Sat Jul 23, 2005 10:16 am Post subject:
Hmmm ... I think I understand what you're trying to do now. You want to get all of the records with the first n keys.
Is 4 the maximum number for n or can it be more? If it can be more, what is the maximum number for n? _________________ 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: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Sat Jul 23, 2005 2:39 pm Post subject:
Here's a DFSORT/ICETOOL job that will do what you asked for (actually, this method is better than the original one I was thinking of since it doesn't matter how large n is):
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//CTL2CNTL DD DSN=&&C1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
* Generate a DFSORT INCLUDE statement as follows:
* INCLUDE COND=(1,9,CH,LE,C'keyn')
* where keyn is the character string for
* the nth key (e.g. '02 1236').
SORT FROM(IN) USING(CTL1)
* Use the generated INCLUDE statement to only include the records
* with a key less than or equal to the nth key.
COPY FROM(IN) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
SORT FIELDS=(1,9,CH,A)
SUM FIELDS=NONE
***>>>> Replace n with the number of the needed key (e.g. 3).
OUTFIL ENDREC=n,
FNAMES=CTL2CNTL,REMOVECC,NODETAIL,
OUTREC=(80X),
TRAILER1=(' INCLUDE COND=(1,9,CH,LE,C''',1,9,C''')')
/*
_________________ 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
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