Hi,
My reqmt is to compare two files of (same LRECL = 2048, and RECFM = FB) based on key and replace the full record in file 2 with that of full record of F1 if the key matches. I do not want to replace the record in file 2 if the key dont matches.
Here is an example:
F1 and F2 both are having same key: (3,3) and (9,2)
Hi Bill,
Thanks for the reply.
In actual the file length is 20476 and RECFM is VB for both input files and have to replace two fields in second file F2 with the values at same position in file 1- one field is of one char length at 531 and second field is packed decimal starts at 532 of length 6.
I am using the below sysin card but it throws the syntax error 'INREC STATEMENT : SYNTAX ERROR '
I was trying to replace only one of the field using the above card. what should be the syntax when we replace two fields.Can you pls guide here. Thanks
Something like that, untested. This may take some explaining, so take the manual, and try to work out what it is doing, including fixing anything. If you get stuck, post back, with the Code tags.
Hi Bill,
I have tried running the job and the second file got updated with much more records than expected.
To test, I had only one record in file 1 and second file was having around 1000 records. Though the key is matching, could there be a possibility that due to VB file, it is somewhere updating the unnecessary records.
Also, can you pls give a quick hint on the below condition so that I can have idea what it says'
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
You need to understand the REFORMAT record.
It will be variable-length, so it needs an RDW (can come from either file). That's the 1,4 bit. Then you have three fixed-length pieces of information you want: two fields from F1, and the match-marker. The two fields are consecutive, feel free to code them as individual fields. The match-marker appears as the ? (you know that) and then we need the entire variable-length data from F2, which we code as "5", which means "from position five to the end of the current record".
Those fields on the REFORMAT record are all in sequential order, so now you should understand the positions of everything.
When you get to the BUILD remember what I've just said about the variable parts of records.
Thanks Bill.
Now I have some confusion here - 1. why we are using '12' (starting position) in WHEN condition.
2. OVERLAY=(539:5,7) to which I think should be OVERLAY=(531:531,7) as we are replacing value at 531 in second file with value at 531 of length 7 in file 1.
Thanks
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Because we've added eight bytes to the start of the record, in the REFORMAT statement. Read what I wrote again. Go through it with pencil and paper. See what happens from the creation of the REFORMAT record through to the creation of the output.