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)
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 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'
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.
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.
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.