I'm trying to put together some REXX code to achieve the following.
Check given input(0007145547162165876, 0002734752467588968, 555729879318548867, 5559871342286434816)for a given condition (first 3 characters are 000). If so, perform some computation on that input (as below).
b. If condition not met (i.e first 3 characters not 000 ), perform a different computation on that input.
Printout the results of both computations in one file.
Below is the code I have for the first if conditional statement and it works as desired. Problem is implementing the second condition. How do I achieve this?
if substr(rec.i,3,3) == '000'
then do
sum = d1+d2+d5+d6+d7+d8+d9+d10+d11+d12+d13+d14+d15+d16
sum = sum * 9
chksum = substr(sum,2,2)
chk = d3||d4
if chksum = chk
then do
say 'valid check sum' chksum 'in' rec.i
out.1=rec.i
"EXECIO 1 DISKW DATA (stem out."
end
else do
say '*** invalid check sum' chk 'in' rec.i
say '*** check sum should be' chksum 'in' rec.i
out.1=rec.i
"EXECIO 1 DISKW OUTFILE (stem out."
end
end
end