I should basically convert this 123 into binary (D2X followed by X2B)
Quite confusing. . . If the value is 123 and the field is binary, it will already
be x'7b'. . .
Also, if you scan the "input" for some x'..' value anywhere in the record, you will get "hits" in places you will not want. . . For example, the x'7b' is the #. . . x'c1' (193) is the letter A.
You might want to consider writing this in cobol and using the actual record layout in the code. I believe it will be easier to implement and far easier to maintain.