IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to duplicate n times a record ?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Thu Mar 01, 2007 4:28 am
Reply with quote

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
View user's profile Send private message
dineshness

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Fri Mar 02, 2007 12:03 am
Reply with quote

It will definitely require another OPERATOR to be included in the future releases of DFSORT unless Frank has other ideas... icon_biggrin.gif

Dinesh.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Mar 02, 2007 12:44 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Mar 02, 2007 5:54 am
Reply with quote

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
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Fri Mar 02, 2007 3:23 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Mar 02, 2007 9:46 pm
Reply with quote

You can read all about DFSORT exits in Chapter 4 of "z/OS DFSORT Application Programming Guide" which you can access from:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top