Chapter Contents

Previous

Next
execrc

execrc



Set Return Code of Most Recent Subcommand

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTIONS
IMPLEMENTATION
EXAMPLE


SYNOPSIS

#include <exec.h>

int execrc(int rc);


DESCRIPTION

The execrc function is used to set the return code of the most recently executed subcommand. The return code is passed back to any executing EXEC or CLIST and is accessible via the REXX RC variable, the EXEC2 & RC variable, or the CLIST & LASTCC variable. In all environments, a negative return code is treated as a more serious error than a positive code.


RETURN VALUE

The execrc function returns the maximum return code value that is specified so far. That is, the return value is the maximum of the current execrc argument and any previous argument to execrc . Under TSO and USS, the return code is replaced by its absolute value before the maximum is computed.

execrc returns a negative value if it is unable to successfully store the requested return code.


CAUTIONS

If execrc is called more than once for the same subcommand, the last value set is used, but the execrc return value may reflect the previous value.

If execrc is not called for each subcommand, the old value of rc is retained.

If execrc is not called at all for a subcommand, the return code for the previous subcommand is set, or 0 is used if there is no previous value.


IMPLEMENTATION

Under TSO, if rc is negative, the IKJSTCK service routine is called to flush the stack. Then, the absolute value of rc is stored in the ECTRCDF field, which the CLIST processor uses as the value of the & LASTCC variable.

However, a call to execrc with a negative argument does not flush a REXX EXEC because this functionality is not present in TSO REXX. In this case, the EXEC receives rc unchanged, not its absolute value, as for a CLIST. If execrc is called with a negative argument and one or more CLISTs are active, the CLISTs are still flushed until a REXX EXEC or the terminal is at the top of the stack, at which point flushing stops.

Under CMS, the rc value is the R15 value returned when control is returned to CMS, presumably in search of a new subcommand.


EXAMPLE

See the example for the execget function and the comprehensive SUBCOM example.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.