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

Overlaying a field in one file from another file


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

New User


Joined: 24 Nov 2005
Posts: 49
Location: chennai

PostPosted: Thu Nov 12, 2009 12:45 pm
Reply with quote

Hi ,

1. I have 2 input files.First file is of LRECL 2054 with RECFM as F and it's field at position 50 of 10 bytes has to be overlayed using second input file of LRECL 220bytes RECFM F and field to be overlayed in First file is in position 170 of 10bytes of second file.

2. First file contains 10000 records and second file contains 4000 records.I need to repeat the same data in positon 170 of 10 bytes in 2nd file for rest of 6000 records in overlayed 1st file.

Please suggest me a solution.


regards,
Akash
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Nov 12, 2009 3:02 pm
Reply with quote

What you are asking is not very clear.

Are there matching keys to be used, and if so, what happens if a key is not matched.

If there are no keys to match the records, wil it bee the first 4000 of file 1 that get overlaid, and if not, what happens to the last 6000.
Back to top
View user's profile Send private message
akashs

New User


Joined: 24 Nov 2005
Posts: 49
Location: chennai

PostPosted: Thu Nov 12, 2009 3:28 pm
Reply with quote

Hi Expat,

I dont want the data in column positons 50 to 60 of 1st input file file. I need to replace the data in column position 50 to 60 of 1st input file with 170 to 180 column position of 2nd input file.There is no matching key between 2 input files.Input file1 has 10000 records and input file 2 has 4000 records.I need to repeat the same data in 4000 records in remaining 6000 records of 1st file also.

regards,
akash
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 13, 2009 12:51 am
Reply with quote

FWIW - the code to do this should take about 10-15 minutes. . .

Had the time been spent, the process would have been running 8 or 10 hours ago. . .

d
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 Nov 13, 2009 1:57 am
Reply with quote

akash,

I still don't know what you want to do.

"50 of 10 bytes" is NOT the same as 50-60 which is 11 bytes. Which is it?
170 of 10 bytes" is NOT the same as 170-180 which is 11 bytes. Which is it?

Do you want to replace:

o 50-60 of input file1 record 1 with 170-180 of input file2 record 1
o 50-60 of input file1 record 2 with 170-180 of input file2 record 2
...
o 50-60 of input file1 record 4000 with 170-180 of input file2 record 4000
o 50-60 of input file1 record 4001 with 170-180 of input file2 record 1
...
o 50-60 of input file1 record 8000 with 170-180 of input file2 record 4000
o 50-60 of input file1 record 8001 with 170-180 of input file2 record 1
...

If not, please explain more clearly what you want to do. An example of input and expected output would help.
Back to top
View user's profile Send private message
akashs

New User


Joined: 24 Nov 2005
Posts: 49
Location: chennai

PostPosted: Fri Nov 13, 2009 9:54 am
Reply with quote

Hi Frank,

Positions 50 to 59 of input file 1
Positions 170 to 179 of input file 2.

Yes i am expecting the same output as you mentioned below

o 50-60 of input file1 record 1 with 170-180 of input file2 record 1
o 50-60 of input file1 record 2 with 170-180 of input file2 record 2
...
o 50-60 of input file1 record 4000 with 170-180 of input file2 record 4000
o 50-60 of input file1 record 4001 with 170-180 of input file2 record 1
...
o 50-60 of input file1 record 8000 with 170-180 of input file2 record 4000
o 50-60 of input file1 record 8001 with 170-180 of input file2 record 1
...

can you please provide me the solution for it.

Thanks and regards,
Akash
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: Sat Nov 14, 2009 12:54 am
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/2054)
//IN2 DD DSN=... input file1 (FB/220)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/2054)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(2063,8,ZD) WITHALL -
 WITH(1,49) WITH(60,2011)
SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(50:170,10,2063:SEQNUM,8,ZD,START=0)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(2055:SEQNUM,8,ZD,START=0,
    2063:2055,8,ZD,MOD,+4000,TO=ZD,LENGTH=8)
/*
//CTL3CNTL DD *
  SORT FIELDS=(2055,8,ZD,A)
  OUTREC BUILD=(1,2054)
/*
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: Sat Nov 14, 2009 3:08 am
Reply with quote

With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707, you can use a JOINKEYS application like the following to do the same thing:

Code:

//S2    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//IN1 DD DSN=... input file1 (FB/2054)
//IN2 DD DSN=... input file1 (FB/220)
//SORTOUT DD DSN=...  output file (FB/2054)
//JNF1CNTL DD *
  INREC OVERLAY=(2055:SEQNUM,8,ZD,START=0,
    2063:2055,8,ZD,MOD,+4000,TO=ZD,LENGTH=8)
/*
//JNF2CNTL DD *
  INREC OVERLAY=(2063:SEQNUM,8,ZD,START=0)
/*
//SYSIN    DD    *
  JOINKEYS F1=IN1,FIELDS=(2063,8,A)
  JOINKEYS F2=IN2,FIELDS=(2063,8,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:1,49,F2:170,10,F1:60,2011)
  SORT FIELDS=(2055,8,ZD,A)
  OUTREC BUILD=(1,2054)
/*



For complete details on JOINKEYS applications and the other new functions available with the Nov, 2009 DFSORT PTF, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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
Search our Forums:

Back to Top