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
 

 

Overlaying a field in one file from another file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Overlaying a field in one file from another file
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: 8593
Location: Back in jolly old England

PostPosted: Thu Nov 12, 2009 3:02 pm    Post subject:
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    Post subject: Reply to: Overlaying a field in one file from another file
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

Site Director


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

PostPosted: Fri Nov 13, 2009 12:51 am    Post subject: Reply to: Overlaying a field in one file from another file
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Nov 13, 2009 1:57 am    Post subject:
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    Post subject: Reply to: Overlaying a field in one file from another file
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Nov 14, 2009 12:54 am    Post subject:
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Nov 14, 2009 3:08 am    Post subject:
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:

http://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    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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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