Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to duplicate n times a record ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to duplicate n times a record ?
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    Post subject: Re: How to duplicate n times a record ?
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 Moderator


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

PostPosted: Fri Mar 02, 2007 12:44 am    Post subject:
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 Moderator


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

PostPosted: Fri Mar 02, 2007 5:54 am    Post subject:
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    Post subject: Re: How to duplicate n times a record ?
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 Moderator


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

PostPosted: Fri Mar 02, 2007 9:46 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 5 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am
No new posts Sort Card to Remove Duplicate records... raj4neo SYNCSORT 2 Wed Jan 25, 2017 4:44 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us