Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us