$GOSUB (execute subroutine)
$GOSUB executes a subroutine defined by the [SUB] tag. The subroutine to be executed must be defined before the $GOSUB function appears.
Syntax
$GOSUB(subroutine-name)
Values
-
subroutine-name
For the subroutine name, you can use alphanumeric characters and the underscore (_). However, a numeric character cannot be used as the first character of the subroutine name. Note also that case is considered significant in subroutine names.
Example
The following example creates a subroutine to perform the processing for outputting a message according to the value in the session information MSG:
[SUB]
ECHO
[IF]
MSG = '1'
[THEN]
[SET_VALUE]
$ECHO(ECHOMSG)
[IF_END]
[SUB_END]
[BEGIN]
[SET_VALUE]
MSG = $GETSESSION('MSG')
ECHOMSG = 'Hello world'
$GOSUB(ECHO)
[END]