Recursive Substitution

Recursive substitution allows a phrase in one LET definition to contain a word defined in another LET definition. Recursive substitution can also be used to abbreviate long phrases within LET commands.

Example: Making a Recursive Substitution

In the following LET command

LET
TESTNAME=IF LAST_NAME IS RIGHTNAME
RIGHTNAME = STEVENS OR MCKNIGHT OR MCCOY
END

the word RIGHTNAME in the phrase in the first definition is defined in the second definition. (Note that the two phrases in the LET command could be reversed.) This LET command is equivalent to:

LET
TESTNAME = IF LAST_NAME IS STEVENS OR MCKNIGHT OR MCCOY
END

Example: Abbreviating a Long Phrase

Consider the following LET command, which illustrates recursive substitution:

LET
TESTNAME = STEVENS OR SMITH OR MCCOY OR CONT1
CONT1    = BANNING OR IRVING OR ROMANS OR CONT2
CONT2    = JONES OR BLACKWOOD
END

You can use TESTNAME in this request:

TABLE FILE EMPLOYEE
PRINT SALARY BY LAST_NAME
IF LAST_NAME IS TESTNAME
END

This is the equivalent of:

TABLE FILE EMPLOYEE
PRINT SALARY BY LAST_NAME
IF LAST_NAME IS STEVENS OR SMITH OR MCCOY OR
BANNING OR IRVING OR ROMANS
OR JONES OR BLACKWOOD
END

Information Builders