The following is a sample of system exit usage:
Sample system exit usage
WORKAREARECORD *user_info[2]; /* saved user information */
RXSYSEXIT exit_list[2]; /* system exit list */
user_info[0] = global_workarea; /* save global work area for */
user_info[1] = NULL; /* re-entrancy */
rc = RexxRegisterExitExe("EditInit", /* register exit handler */
&Init_exit, /* located at this address */
user_info); /* save global pointer */
/* set up for RXINI exit */
exit_list[0].sysexit_name = "EditInit";
exit_list[0].sysexit_code = RXINI;
exit_list[1].sysexit_code = RXENDLST;
return_code = RexxStart(1, /* one argument */
argv, /* argument array */
"CHANGE.ED", /* REXX procedure name */
NULL, /* use disk version */
"Editor", /* default address name */
RXCOMMAND, /* calling as a subcommand */
exit_list, /* exit list */
&rc, /* converted return code */
&retstr); /* returned result */
/* process return value */
.
.
.
}
LONG Init_exit(
LONG ExitNumber, /* code defining the exit function */
LONG Subfunction, /* code defining the exit subfunction */
PEXIT ParmBlock) /* function dependent control block */
{
WORKAREARECORD *user_info[2]; /* saved user information */
WORKAREARECORD global_workarea; /* application data anchor */
USHORT query_flag; /* flag for handler query */
rc = RexxQueryExit("EditInit", /* retrieve application work */
NULL, /* area anchor from REXX. */
&query_flag,
user_info);
global_workarea = user_info[0]; /* set the global anchor */
if (global_workarea->rexx_trace) /* trace at start? */
/* turn on macro tracing */
RexxSetTrace(global_workarea->rexx_pid, global_workarea->rexx_tid);
return RXEXIT_HANDLED; /* successfully handled */
}