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.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.
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
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.