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
 

 

Repeat seven times input file in one step

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Guirao

New User


Joined: 27 Nov 2007
Posts: 7
Location: Madrid

PostPosted: Thu Oct 30, 2008 7:21 pm    Post subject: Repeat seven times input file in one step
Reply with quote

Hi,

I want to repeat all input records seven times into the output file through "one only" SORT.

Thanks.
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Oct 30, 2008 7:55 pm    Post subject:
Reply with quote

Probably You need to use
OUTFIL REPEAT=7

But to get precise answer
you need to post sample input and desired output icon_smile.gif
Back to top
View user's profile Send private message
Guirao

New User


Joined: 27 Nov 2007
Posts: 7
Location: Madrid

PostPosted: Thu Oct 30, 2008 8:21 pm    Post subject:
Reply with quote

This is my SORT:

Quote:
//SORT0001 EXEC PGM=SORT
//SORTIN DD DSN=XE04183.INICIO,DISP=SHR
//SORTOUT DD DSN=XE04183.INICIO.SALIDA,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(1,5),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REPEAT=7


and this is my input file:

Quote:
....REC 1
....REC 2


... and the result:

Quote:
....REC 1
....REC 1
....REC 1
....REC 1
....REC 1
....REC 1
....REC 1
....REC 2
....REC 2
....REC 2
....REC 2
....REC 2
....REC 2
....REC 2


But I want to repeat the block of the input file, so i wish is that following:

Quote:
....REC 1
....REC 2
....REC 1
....REC 2
....REC 1
....REC 2
....REC 1
....REC 2
....REC 1
....REC 2
....REC 1
....REC 2
....REC 1
....REC 2


Thanks[/quote]
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Oct 30, 2008 8:40 pm    Post subject:
Reply with quote

Change your code as below
Code:

//SORT0001 EXEC PGM=SORT
//SORTIN DD DSN=XE04183.INICIO,DISP=SHR
//       DD DSN=XE04183.INICIO,DISP=SHR
//       DD DSN=XE04183.INICIO,DISP=SHR
//       DD DSN=XE04183.INICIO,DISP=SHR
//       DD DSN=XE04183.INICIO,DISP=SHR
//       DD DSN=XE04183.INICIO,DISP=SHR
//       DD DSN=XE04183.INICIO,DISP=SHR
//SORTOUT DD DSN=XE04183.INICIO.SALIDA,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(1,5),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
/*
Back to top
View user's profile Send private message
Guirao

New User


Joined: 27 Nov 2007
Posts: 7
Location: Madrid

PostPosted: Thu Oct 30, 2008 8:49 pm    Post subject:
Reply with quote

OK, the results where exactly what i want.

Thanks a lot.
Regards.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Oct 30, 2008 8:52 pm    Post subject:
Reply with quote

Quote:
OK, the results where exactly what i want.

Thanks a lot.

U R Welcome icon_smile.gif
Back to top
View user's profile Send private message
cybertaurean

New User


Joined: 22 Dec 2008
Posts: 85
Location: US

PostPosted: Thu Sep 29, 2011 4:06 pm    Post subject:
Reply with quote

@Escapa... Can anything be done through sort if the # of required repetitions (in the fashion mentioned above) is huge... say 10000 times.

I believe dataset concatenation wouldn't work in such a case. Any other option to get it done using SORT?

Regards,
C.T.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Sep 29, 2011 4:54 pm    Post subject: Reply to: Repeat seven times input file in one step
Reply with quote

'course you can.

Use the first method to replicate the individual records 10000. Sequence number each individual record starting from 1 until the next record that gets replicated. Sort on the sequence number, with EQUALS, strip off the sequence number. You should have now a file which is replicated in its' entirety 10,000 times.

Don't have the code for it (I think you were just curious :-) ). Don't know if it can be done in one step. Don't see why it can't be done. Can't imagine yet why anyone would want to.

Frank or Kolusu will probably say I don't need to over-complicate, and do it in two lines :-) They, and the product, are so good that nothing would surprise me.
Back to top
View user's profile Send private message
cybertaurean

New User


Joined: 22 Dec 2008
Posts: 85
Location: US

PostPosted: Thu Sep 29, 2011 10:06 pm    Post subject:
Reply with quote

@bill: awesome! i was thinking on lines of what u felt kolusu or frank might talk about... i.e. without having to use a sequence number icon_smile.gif

thanks a lot!!! icon_biggrin.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Sep 29, 2011 10:11 pm    Post subject: Reply to: Repeat seven times input file in one step
Reply with quote

cybertaurean wrote:
@Escapa... Can anything be done through sort if the # of required repetitions (in the fashion mentioned above) is huge... say 10000 times.



cybertaurean,

As bill mentioned here it CAN be done. And bill yes it is indeed easy icon_wink.gif ,however there is a catch.


Case 1
If Number of input records >= repetition factor then 1 pass of data with JOINKEYS

case 2

If Number of input records < repetition factor then you need 2 passes of data.


Case 1 solution

Joinkeys can be used to do Many to Many match. And we will use that feature to generate the data. The trick here is to use the same dataset for both JNF1 and JNF2 and then match on a key we add at the end of the record.

Code:

//STEP0100 EXEC PGM=SORT,REGION=0M         
//SYSOUT   DD SYSOUT=*                     
//INA      DD *                             
REC01                                       
REC02                                       
REC03                                       
REC04                                       
REC05                                       
REC06                                       
REC07                                       
REC08                                       
REC08                                       
REC10                                       
//INB      DD *                                   
REC01                                             
REC02                                             
REC03                                             
REC04                                             
REC05                                             
REC06                                             
REC07                                             
REC08                                             
REC08                                             
REC10                                             
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                   
  JOINKEYS F1=INA,FIELDS=(81,1,A),SORTED,NOSEQCK   
  JOINKEYS F2=INB,FIELDS=(01,1,A),SORTED,NOSEQCK   
  REFORMAT FIELDS=(F1:1,80,F2:2,8)                 
  INCLUDE COND=(81,8,ZD,LE,7)      <<== CODE REPEAT FACTOR HERE
  SORT FIELDS=(81,8,CH,A),EQUALS                   
  OUTREC BUILD=(1,80)                             
//*                                               
//JNF1CNTL DD *                                   
  INREC OVERLAY=(81:X)                             
//*                                               
//JNF2CNTL DD *                                   
  INREC BUILD=(X,SEQNUM,8,ZD)                     
//*



Case 2 solution:

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
REC01                                                           
REC02                                                           
REC03                                                           
//SORTOUT  DD DSN=&&IN,DISP=(,PASS),SPACE=(CYL,(10,10),RLSE)   
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  OUTREC OVERLAY=(81:SEQNUM,8,ZD)                               
  OUTFIL REPEAT=7,                <<== CODE REPEAT FACTOR HERE 
  IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(81,8)))   
//*                                                             
//STEP0200 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=&&IN,DISP=SHR                                 
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=(81,8,CH,A),EQUALS                               
  OUTREC BUILD=(1,80)                                           
//*
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Sep 30, 2011 6:04 am    Post subject: Reply to: Repeat seven times input file in one step
Reply with quote

Very nice, Kolusu, very nice.

So, when requiring multiple duplications of a dataset:


  • If it needs only be "logical", concatenate (up to max allowed) into desired program


  • If it needs to be "physical" (on one dataset)
    concatenate with sort, up to max allowed
  • Else, Case 1 when records >= repetition factor
  • Otherwise, Case 2

If it is a close call for Case 1, Case 2 will always work, but with two passes of the data.
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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Restart=Step not working ALAK SAHA JCL & VSAM 6 Fri Jun 30, 2017 6:28 pm


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