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

Copy contents in a file repeatedly, dynamically


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

New User


Joined: 18 Mar 2007
Posts: 44
Location: New Jersey,USA

PostPosted: Thu Apr 10, 2008 8:41 am
Reply with quote

Hi,
I have requiremnt , where i have to copy the File / or its contents, based on the Count obtained from previuos step.

For Ex.
Step1: returns a count of 10,
I have to copy in step2 a FILEA 10 times.

The value returned by step1 can vary at different times.

I have to do it for Testing purposes where my input File will return the number of records it needs . I have a standard file with few records, and once i repeat the contents of it based on count, i can use simple Sort utilities like seq num to vary the data among the records.

Can i use arithemtic operators also for mulitplying with count?
say, count =6 , i want to actually do it also with 6 * 5 times etc ..
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: Thu Apr 10, 2008 8:49 pm
Reply with quote

It's not clear to me what you want to do. Please show an example of the records in each input file and what you want for output. Explain clearly what you want to do based on the example. Give the RECFM and LRECL of each input file. Give the starting position, length and format of each relevant field.
Back to top
View user's profile Send private message
VIGNRSH
Warnings : 1

New User


Joined: 18 Mar 2007
Posts: 44
Location: New Jersey,USA

PostPosted: Fri Apr 11, 2008 7:21 am
Reply with quote

HI ,

File 1: contains lrecl =80, recfm=fb it contains only the following
count 0000010
File 2 : Lrecl =80 , Recfm =FB
1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2xxxxxxxxxxxxx
3xxxxxxxxxxxxxxxxxxxxxxxxxxxx
4xxxxxxxxxxxxxxxxxxxxx
5xxxxxxxxxxxxxxxxxxxx

Output file should be like...
File3:
1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2xxxxxxxxxxxxx
3xxxxxxxxxxxxxxxxxxxxxxxxxxxx
4xxxxxxxxxxxxxxxxxxxxx
5xxxxxxxxxxxxxxxxxxxx
1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2xxxxxxxxxxxxx
3xxxxxxxxxxxxxxxxxxxxxxxxxxx
4xxxxxxxxxxxxxxxxxxxx
5xxxxxxxxxxxxxxxxxxx
1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2xxxxxxxxxxxxx
3xxxxxxxxxxxxxxxxxxxxxxxxxxxx
4xxxxxxxxxxxxxxxxxxxxx
5xxxxxxxxxxxxxxxxxxxx
.

10 times..(5 records from file 2 will occur in output file3 10 times totally.)
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 11, 2008 7:11 pm
Reply with quote

Seems like it would be easier to REXX generate sort/copy JCL to concatinte the DD those 10 (variable) times and then run the sort copy....
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 Apr 11, 2008 10:23 pm
Reply with quote

Does file2 always have 5 records or can the number of records it has vary (if so, what is the maximum number of records)?

Does file2 actually have a 1-byte sequence number in position 1 of each record?
Back to top
View user's profile Send private message
VIGNRSH
Warnings : 1

New User


Joined: 18 Mar 2007
Posts: 44
Location: New Jersey,USA

PostPosted: Sun Apr 13, 2008 12:24 am
Reply with quote

Hi ,
No the records in file2 are not fixed.But i think i can get the record count of FILE2 just by simple sort step before that..
The File2 is not key sequenced.SO even if has data all over and no Key information, I just need it to copied based on the count present in FILE1.
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: Sun Apr 13, 2008 10:34 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/80) - count
//IN2 DD DSN=...  input file2 (FB/80)
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(C1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SORT FROM(T1) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(C'  REPEAT=',1,8,80:X)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD)
  OUTFIL FNAMES=T1,OVERLAY=(89:SEQNUM,8,ZD,RESTART=(81,8)),
/*
//    DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)
//CTL3CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(89,8,ZD,A)
  OUTREC BUILD=(1,80)
/*
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Apr 14, 2008 5:11 pm
Reply with quote

Hi Frank,

I don't understand the way you specify the REPEAT option? Shouldn't it be specified along with the OUTREC keyword? How does this work?
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: Mon Apr 14, 2008 8:22 pm
Reply with quote

I'm not sure what you mean. I "generated" the REPEAT=n part of the CTL2CNTL statements based on the count in input file1. For a count of 10 in input file1, the complete CTL2CNTL control statement are as follows:

Code:

  INREC OVERLAY=(81:SEQNUM,8,ZD)                               
  OUTFIL FNAMES=T1,OVERLAY=(89:SEQNUM,8,ZD,RESTART=(81,8)),   
  REPEAT=0000010                                               


As you can see, I'm using OVERLAY with REPEAT.

The best way to analize this or any other DFSORT job is to print out the intermediate files to see what they look like (e.g. C1, T1).
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Apr 14, 2008 9:10 pm
Reply with quote

Oops, I got it wrong where to "DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS) " was "pointing" - thought is was CNT3CNTL, but infact it hangs on CTL2CNTL...

Thanks...
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 Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top