In translating codes from one database to the next, I have to use an IF LET ENDIF for each code. IF $CODE = 'A11' LET $CODE = 'AAA' END-IF IF $CODE = 'B11' LET $CODE = 'BBB' END-IF IF $CODE = 'C11' LET $CODE = 'CCC' END-IF. . .ad nauseum
Is there a way in SQR to do a positional replace? REPLACE ('A11', 'B11', 'C11') IN ('AAA', 'BBB', 'CCC')
Thanks, David
Unfortunately, both the REPLACE and TRANSLATE sub-commands of the LET Statement only allow a single transformation.
As an alternative to multiple if-then-else's, you could use the Evaluate statement:
This would make the code easier to review and less verbose.