At a basic level, if you have a variable in REXX, and you want to find a string in a specific position, then the POS
function would give you what you want.
Another method would be to use the very powerful PARSE
instruction, which is something you'll need to learn at some point anyway. You can parse a variable into tokens on specific offsets.
Given your original example, let's say I have the variable rec
03 123 NAME1 ADDR1
I could code:
fnd1 = Pos('123',rec)
fnd2 = Pos('NAME1',rec)
and then I could check for:
If fnd1 = 4 & fnd2 = 8 Then ... do something if both are present ...
or, using a PARSE:
Parse Var rec fld1 4 fld2 8 fld3 14 fld4
If fld2 = '123 ' & fld3 = 'NAME1 ' Then ... do something if both are present ...
You can try this website for some REXX tutorials:Classic Rexx Tutorial