Returns the current NCL process's return code or sets a new return code value.
NCL statements can set &RETCODE as an indication of the success or otherwise of the function. A procedure can set a value in the range 0 to 99 for &RETCODE.
&RETCODE is used to indicate the completion of a function performed by a nested procedure.
&RETCODE used as a statement, sets the value to that specified.
A value of 100 is set by the system if the &CONTROL FINDRC option is set. This option allows a procedure to determine the success of a request for a nested procedure. If the requested procedure does not exist and &CONTROL FINDRC is set, processing continues but &RETCODE is set to a value of 100. If &CONTROL FINDRC is not set, the requesting procedure terminates.
A new value, in the range 0 to 99, to be placed in &RETCODE.
Example: &RETCODE
&IF &RETCODE NE 0 &THEN +
&WRITE DATA=FUNCTION FAILED.
&RETCODE 4
&CONTROL FINDRC
-EXEC &REQUEST
&IF &RETCODE EQ 100 &THEN +
&WRITE DATA=Requested Procedure '&REQUEST' Not Found
Notes:
A nested procedure can set a return code on the &END statement. On return to the higher level, &RETCODE contains the return code value.
If &RETCODE has not been set, it has a default value of 0.
An alternative to using the &END statement to pass a return code is to use the &RETURN statement, which can return variables to a higher nesting level, or &CONTROL SHRVARS, which allows sets of variables to be shared between procedures.
| Copyright © 2009 CA. All rights reserved. |
|