I have developed a small rexx code which replaces the characters with the mentioned values, in a single line statement.
This is the input statement I give for the replacing the &B with 'M'
XXX&J..&A&B&C&D..CD&E&I.AT.HARI(+1)
/* I call the FUNCTION HERE */
F8=STRREP(F7,'&B','M')
/* function to replace chars */
STRREP:
FIL_STR = ARG(1)
STR1 = ARG(2)
STR2 = ARG(3)
DO FOREVER
INTERPRET 'PARSE VAR FIL_STR PART1' "'"STR1"'" 'PART2'
IF (FIL_STR <> PART1) THEN FIL_STR = PART1||STR2||PART2
ELSE LEAVE
END
RETURN FIL_STR
F8=STRREP(F7,'&B','M')
/* function to replace chars */
STRREP:
FIL_STR = ARG(1)
STR1 = ARG(2)
STR2 = ARG(3)
DO FOREVER
INTERPRET 'PARSE VAR FIL_STR PART1' "'"STR1"'" 'PART2'
IF (FIL_STR <> PART1) THEN FIL_STR = PART1||STR2||PART2
ELSE LEAVE
END
RETURN FIL_STR
When I run the above code, I m getting the desired result.. but an error shows up at the end of processing, which is "Invalid Whole number".
Something is passed between the call and the function, but I am unable to have this resolved. Could you please help