Calling subroutines
Subroutines can be used to improve processing time and control the number of pattern action sets that need to be coded.
CALL <subroutine name>
Because pattern action sets are executed sequentially, it is fastest to test for a generic type and call a subroutine to process that type. This is best illustrated by an example:
*U
CALL UNITS
If a unit type (U) is detected anywhere in the input, the subroutine Units is called to process the apartment numbers. Subroutine names are formed according to the same rules as variables names (up to 32 characters with the first character being alphabetic).
If a subroutine that does not exist is called, the rule set aborts at runtime.
Returning from a subroutine
You can return control from a subroutine to the main program with a RETURN action.
The RETURN action is available to return control from a subroutine to the main program. A RETURN is not required immediately preceding the \END_SUB statement.