Returns from a subroutine within a procedure.
&RETSUB [ returncode ]
Common processing routines within an NCL procedure may be placed in subroutines. Control is transferred to a subroutine using the &GOSUB statement. The subroutine returns control to the statement following the &GOSUB by issuing an &RETSUB statement. There is a one to one correlation between each &GOSUB and its associated &RETSUB, allowing nested subroutine calls.
Operands:
A return code in the range 0 to 99 may be specified. This is available in the variable &RETCODE on return to the calling statement. A return code outside these ranges will cause termination of the procedure.
Examples: &RETSUB
.GETSUB -* subroutine to get a request from a user
-*
-* Subroutine processing
-*
&IF &RETCODE = 4 &THEN +
&RETSUB
&RETSUB 0
Notes:
If &RETSUB is issued without a preceding &GOSUB, the statement is ignored.
If &RETSUB is specified without any other operands, any existing value of &RETCODE is retained. Thus the following are equivalent:
&RETSUB 4
&RETCODE 4 &RETSUB
| Copyright © 2009 CA. All rights reserved. |
|