Chapter Contents

Previous

Next
ESTAE

ESTAE



Define an Abnormal Termination Exit

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTIONS
EXAMPLE
RELATED FUNCTIONS


SYNOPSIS

#include <spetask.h>

int ESTAE(void *exit, create, void *param, asynch, term);

int ESTAE_CANCEL(void);


DESCRIPTION

The SAS/C ESTAE and ESTAE_CANCEL macros implement the functionality of the OS/390 assembler ESTAE macro. This macro is supported only with the Systems Programming Environment (SPE).

The exit argument of ESTAE is the address of code to receive control if the program ABENDs. This argument should ordinarily be specified as a call to the bldexit function, whose first argument is the address of the C function that is to be defined as the exit.
create must be either CT or OV . Specify CT if a new ESTAE exit is to be defined, or OV if the previous exit is to be overlaid.
param specifies a pointer that is to be made available to the ESTAE exit when it is called.
asynch must be specified as ASYNCH or NOASYNCH , to indicate whether or not asynchronous interrupts are allowed in the exit.
term must be specified as TERM or NOTERM . Indicates whether the exit is to be given control for no-retry terminations such as operator cancel.

The ESTAE_CANCEL macro has the same effect as the assembler ESTAE macro with an exit address of 0 . That is, it cancels the most recently defined ESTAE exit.


RETURN VALUE

The ESTAE and ESTAE_CANCEL macros return the ESTAE assembler macro return code in register 15.


CAUTIONS

Use of the ESTAE macro in code that uses the full run-time library interferes with library ABEND handling. Additionally, the bldexit function cannot be used with the full run-time library.

Similar functionality to ESTAE can be obtained with the full library by defining signal handlers for SIGABRT or SIGABND.


EXAMPLE

This example sets up an ESTAE exit and uses SETRP macros within the exit to perform a retry.

#include <spetask.h>
#include <bldexit.h>
#include <setjmp.h>

jmp_buf retrybuf;
int rc;

static void estaeex();
extern void msgwtr();             /* message-writing subroutine   */

if (setjmp(retrybuf)) goto retrying;
    /* Set up jump buffer for retry.                              */

rc = ESTAE(bldexit(&estaeex, ASYNCH+NOR13), CT, 0, NOASYNCH, NOTERM);
if (rc != 0) {
   msgwtr("ESTAE macro failed!");
   ABEND(1066, rc, DUMP, USER);       /* Give up after failure.   */
}
.
.
.
retrying:                             /* Retry code here.         */
.
.
.

static void estaeex(void **sa, char **poi) {
   void *SDWA;

   if ((int) sa[2]  == 12)            /* Check R0 for 12.         */
      return;                         /* Give up if no memory.    */
   SDWA = sa[3];                      /* Find the SDWA.           */
   SETRP_DUMP(SDWA, YES);             /* Take dump before retry.  */
      /* request a retry at label retrying above                  */
   SETRP_RETRY(bldretry(retrybuf, 1), NOFRESDWA);
   return;
}


RELATED FUNCTIONS

bldexit , SETRP , signal


Chapter Contents

Previous

Next

Top of Page

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