HP OpenVMS Systems

ask the wizard
Content starts here

DEC C return 0 status and DCL $STATUS?

» close window

The Question is:

Returning a $STATUS to DCL from a DECC app?     With VAXC/VAX we could
return a code from the application 'return' statement, so that RETURN 0 -->
$STATUS = 0 and RETURN 1 --> $STATUS = 1. With DECC/Alpha, $STATUS is set to
1 in either case (like it's ign
oring the argument).         Is this fixable with a compile switch or do we
need to recode with system calls?

The Answer is :

  A value of zero is not a defined return status value on OpenVMS, non-zero
  even values indicate failures.
  The value propogated back to DCL by a C return call in the main routine
  is the same as if exit() had been called, and can be a status value of
  EXIT_SUCCESS (0), EXIT_FAILURE (1), or a number from 2 to 255:
    o A status value of 0 or EXIT_SUCCESS is translated to the OpenVMS
      SS$_NORMAL status code to return the OpenVMS success value.
    o A status value of 1 or EXIT_FAILURE is translated to an error-level
      exit status. The status value is passed to the parent process.
    o Any other status value is left the same.
  If you wish to return a zero status, you will need to use sys$exit(0).
  An ANSI-compliant way to return with unsuccessful status is to use the
  EXIT_FAILURE macro value defined in the stdlib.h header.

answer written or last revised on ( 11-JUN-1999 )

» close window