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 How to select record x+7 or x+2 based... JoAnn Kulcyk SYNCSORT 6 Tue Jan 16, 2018 10:49 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm

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