Return values
Functions return their answer to a variable. You must assign the return value to a variable in order to access the return value. In the example below, REVERSE is the name of the function (which reverses the content of the argument). The argument is a variable called %%Barcode. The answer is stored in the original variable, changing the value of that variable.
%%Barcode = REVERSE(%%Barcode)
Or, you could store the answer as the value of a different variable as follows:
%%Newbar = REVERSE(%%Barcode)
A function returns its result and also sets three system variables:
- return code (%%RC)
- return value (%%RV)
- return message (%%RM)
Note: If you want to use the %%RC, %%RM, or %%RV system variable anywhere other than directly after the function call, you must set their values to another variable. This is because the value of system variables can change frequently. If a value is assigned to %%RC and later in the code you are expecting that value to still be in %%RC, it may not be because subsequent function calls or section changes could have modified the value.