NET/MASTER Network Control Language (NCL) Reference Manual

&SYS.RETCODE
System Variables
5–94 106126 Tandem Computers Incorporated
&SYS.RETCODE The &SYS.RETCODE system variable contains the current system return code or
contains a new user-assigned return code value. If &SYS.RETCODE has not been set,
it contains a default value of 0 (zero). This system variable can be assigned a value in
the range 0 (zero) through 99 by an NCL procedure.
The FINDRC operand of the CONTROL verb allows a procedure to determine the
success of a call to a lower-level procedure. If the requested procedure does not exist
and CONTROL FINDRC is set, the call fails. Processing continues, and
&SYS.RETCODE is set to a value of 100. If CONTROL FINDRC is not set, the NCL
process terminates.
&SYS.RETCODE [ =
value
]
value
specifies a new value, in the range 0 through 99, to be placed in &SYS.RETCODE.
Considerations
The RETURN core statement can return variables to a higher nesting level of a
procedure or function. The SHRVARS operand of the CONTROL verb allows sets
of variables to be shared between procedures or functions. Using the SHRVARS
operand is one method you can use to pass newly assigned values of variables
back to calling procedures or functions. However, if you do not wish to use the
SHRVARS feature, the &SYS.RETCODE system variable is available for passing
single values from one procedure or function to another.
See also the RETURN core statement in Section 2, “Core Statements.”
See also the CONTROL and START verbs in Section 3, “Verbs.”
Example
The following example of a procedure called RETCODE shows that NCL sets the
&SYS.RETCODE system variable to 100 when a procedure called SNOOPY is not
found:
RETCODE: PROCEDURE
CONTROL FINDRC
CALL SNOOPY
IF &SYS.RETCODE = 100 THEN SAY "SNOOPY NOT AT HOME"
END RETCODE