Example in ILE C: Removing exit programs and deregistering exit points
This ILE C program removes an exit program from an exit point. After the successful completion of the removal, the program deregisters the exit point from the registration facility.
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
/********************************************************************/
/* PROGRAM: Remove an Exit Program */
/* Deregister an Exit Point */
/* */
/* LANGUAGE: ILE C */
/* */
/* DESCRIPTION: This program removes an exit program and */
/* deregisters an exit point from the registration */
/* facility. */
/* */
/* APIs USED: QusRemoveExitProgram - Remove Exit Program */
/* QusDeregisterExitPoint - Deregister Exit Point */
/* */
/********************************************************************/
/* NOTE: This example uses APIs that are shipped with *EXCLUDE */
/* authority. The user needs *USE authority to the service */
/* program QUSRGFA1 to use these APIs. */
/********************************************************************/
/********************************************************************/
/* Includes */
/********************************************************************/
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <qusrgfa1.h>
#include <qusec.h>
#include <qliept.h>
/********************************************************************/
/* Structures */
/********************************************************************/
typedef struct { /* Error code */
Qus_EC_t ec_fields;
char exception_data[100];
} error_code_struct;
/********************************************************************/
/* */
/* main */
/* */
/********************************************************************/
int main()
{
int pgm_num=1;
error_code_struct error_code;
/******************************************************************/
/* Remove an exit program from the exit point and then deregister */
/* the exit point. It is not necessary to remove exit programs */
/* from an exit point before deregistering the exit point. It is */
/* done here only for illustration purposes. */
/******************************************************************/
/******************************************************************/
/* Initialize the error code parameter. To have exceptions */
/* signaled to this program by the API, set the bytes provided */
/* field of the code to zero. This program has exceptions sent */
/* through the error code parameter; therefore, the bytes */
/* provided field is set to the number of bytes that this program */
/* gives the API for the parameter. */
/******************************************************************/
error_code.ec_fields.Bytes_Provided=sizeof(error_code_struct);
/******************************************************************/
/* Call the API to remove the exit program. */
/******************************************************************/
QusRemoveExitProgram("EXAMPLE_EXIT_POINT ",
"EXMP0100",
pgm_num,
&error_code);
/******************************************************************/
/* If an exception occurs, the API returns the exception in the */
/* error code parameter. The bytes available field is set to */
/* zero if no exception occurs and nonzero if an exception does */
/* occur. */
/******************************************************************/
if (error_code.ec_fields.Bytes_Available != 0)
{
printf("ATTEMPT TO REMOVE EXIT PROGRAM FAILED WITH EXCEPTION: %.7s",
error_code.ec_fields.Exception_Id);
exit(1);
}
/******************************************************************/
/* If the call to remove the exit program is successful, */
/* deregister the exit point. */
/******************************************************************/
/******************************************************************/
/* Call the API to add the exit program. */
/******************************************************************/
QusDeregisterExitPoint("EXAMPLE_EXIT_POINT ",
"EXMP0100",
&error_code);
/******************************************************************/
/* If an exception occurs, the API returns the exception in the */
/* error code parameter. The bytes available field is set to */
/* zero if no exception occurs and nonzero if an exception does */
/* occur. */
/******************************************************************/
if (error_code.ec_fields.Bytes_Available != 0)
{
printf("ATTEMPT TO DEREGISTER EXIT POINT FAILED WITH EXCEPTION: %.7s",
error_code.ec_fields.Exception_Id);
exit(1);
}
} /* End program */