CALL
Invokes a subroutine within a dialog division.
Type
Control structure or branching statement
Format
CALL label_name . . . [label_name:] - label_name
- The 1- to 255-character label name of the subroutine.
- [label_name:]
- The 1- to 255-character label name; this identifies the branch point and the start of the subroutine. (This is not actually a parameter of CALL; the called routine begins here.)
Usage Notes®
- Use only the following characters in label_name:
alphabetic numeric underscore (_) pound sign (#) at sign (@) - Do not use imbedded blanks in label_name.
- Code a colon (:) after label_name when it identifies the branch point (the start of the subroutine).
- Do not code a colon after label_name when it is a parameter of CALL.
- The subroutine you call should end with a RETURN statement so that when the subroutine ends, the Dialog Manager returns control to the statement following that CALL statement.
- If you end the subroutine with an EXIT, the subroutine call stack is purged and the Dialog Manager returns to the next SSPL statement after the top level CALL.
- If you do not use either an EXIT or RETURN, the Dialog Manager continues processing until the end of the code division. It does not return to the statement following the branch point. The next placeholder, which starts the next code division, ends the subroutine.
- CALL operates only within a dialog division. For example, you cannot invoke a subroutine in the EPILOGUE from a CALL in the PROLOGUE.
- Do not use the SELECT statement from a CALLed subroutine.
Example
CALL invokes subroutine setdata,
which is specified without a colon (:). The label setdata,
which is specified with a colon, marks the start of the subroutine.
The return command returns control to the statement following
the call statement.
call setdata
set w x+y+z
...
setdata:
set x 4
set y 6
set z 8
return