View previous topic :: View next topic
|
Author |
Message |
Searchman
New User
Joined: 28 Dec 2006 Posts: 80 Location: France
|
|
|
|
How to duplicate n times a record where n is given by a field of this same record ?
Input file :
A 3 XXX
B 2 YYY
C 1 ZZZ
D 1 UUU
The 2nd field in Input file gives the number (3, 2, 1, 1) of records to be duplicated in output file
Output file
A XXX
A XXX
A XXX
B YYY
B YYY
C ZZZ
D UUU
Thank you for your help. |
|
Back to top |
|
|
dineshness
New User
Joined: 25 Dec 2006 Posts: 63 Location: Perambalur
|
|
|
|
It will definitely require another OPERATOR to be included in the future releases of DFSORT unless Frank has other ideas...
Dinesh. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
OUTFIL REPEAT=n can be used to repeat every record n times. If it's just a few input records, you could generate a COPY operator to repeat each record according to its count. But at one COPY operator per record, I don't think it would take many records before that got impractical. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Actually, this would be quite easy to do using an E15 exit. The exit could just look at each record DFSORT passes to it and use the count to pass the record back count-1 times for insert (RC=12) and one time for accept (RC=0). |
|
Back to top |
|
|
Searchman
New User
Joined: 28 Dec 2006 Posts: 80 Location: France
|
|
|
|
Thank you,
But I don't know what is E15 and what it is required for...
Where can I find descriptions and examples about it ? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
|