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

Modifying a records of a file using input from another file


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

New User


Joined: 02 Jun 2006
Posts: 5

PostPosted: Wed Sep 20, 2006 3:23 pm
Reply with quote

I have two files (file 1 & file 2) a below. I want to modify only last two bytes of file 2 to 95 in the places of 00. But changes in file 2 only to record keys found in file 1.
Files are FB.

Many Thanks.


File 1:
AAAAA
CCCC
FFFFFFF


File 2:
10AAAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
10BBBBBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
10CCCCCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
10EEEEEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
10FFFFFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
10DDDDDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00
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: Wed Sep 20, 2006 8:17 pm
Reply with quote

In file1, you have five A's, four C's and seven F's. In file2, you have 5 A's, five C's and five F's. It's not clear which of these you consider a match and which you don't. Please clarify.

What is the starting position and length of the "key" in file1? What is the starting position and length of the "key" in file2?

What is the RECFM and LRECL of file1 and file2?

Show the output you expect for the example input records you showed.
Back to top
View user's profile Send private message
balaa

New User


Joined: 02 Jun 2006
Posts: 5

PostPosted: Thu Sep 21, 2006 3:07 pm
Reply with quote

I am very sorry for not giving the out all information in first instance.
Please disregard my previous post.

I have two files (file 1 & file 2) a below. I want to modify only last two bytes of file 2 to 95 in the places of 00. But changes in file 2 only to record keys found in file 1.


File 1:
AAAAA
CCCCC
FFFFF

File1, sequential file of Lrecl = 50 and recfm = FB, key position = 1 key length = 5.

File 2:
10AAAAA- 66 bytes of other info- 00
10BBBBB- 66 bytes of other info- 00
10CCCCC- 66 bytes of other info- 00
10EEEEE- 66 bytes of other info- 00
10FFFFF- 66 bytes of other info- 00
10DDDDD- 66 bytes of other info- 00

File2, sequential file of lrecl = 100 and recfm = FB, key position = 3 key length = 5.


Output should be
10AAAAA- 66 bytes of other info- 95
10BBBBB- 66 bytes of other info- 00
10CCCCC- 66 bytes of other info- 95
10EEEEE- 66 bytes of other info- 00
10FFFFF- 66 bytes of other info- 95
10DDDDD- 66 bytes of other info- 00

Keys should match

Many Thanks
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 Sep 21, 2006 9:33 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed that 00/95 is in positions 99-100 (the last two bytes of the file2 records). Since you want your records in their original order rather than sorted by the key, we need an extra SORT operator.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/50)
//IN2 DD DSN=...  input file2 (FB/100)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/100)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(3,5,CH) -
  KEEPNODUPS WITH(1,98) WITH(101,8)
SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(3:1,5,99:C'95',101:8X)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(101:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
  SORT FIELDS=(101,8,ZD,A)
  OUTREC BUILD=(1,100)
/*
Back to top
View user's profile Send private message
balaa

New User


Joined: 02 Jun 2006
Posts: 5

PostPosted: Fri Sep 22, 2006 2:05 pm
Reply with quote

Many Thanks for the solution. It is very much appreciated.

Thanks Again
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(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
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
Search our Forums:

Back to Top