if (error_code.ec_fields.Bytes_Available != ð)
{
printf("ATTEMPT TO REGISTER EXIT POINT FAILED WITH EXCEPTION: %.7s",
error_code.ec_fields.Exception_Id);
exit(1);
}

Message Data—Example:

If your program needs to handle different exceptions in
different ways, you may need to make use of both the message data and the
message ID. The message data is returned in the same format as when you
display the message description on an AS/400. For example, if message
CPF3C1E is received, some of the message data is printed. You can see
message data that is associated with the message by using the Display Message
Description (DSPMSGD) command. The message data for message CPF3C1E is
defined as:
BIN(4) Parameter number
CHAR(256) ILE entry point name
To receive all of the message data for this exception, the exception data field of the
error code structure would need to be at least 260 bytes in size. The following
example uses only the number of bytes shown for the parameter number of the
exception in the message data; therefore, the exception data field only needs to be
4 bytes.
int parm_number;
char \temp_ptr;
if (error_code.ec_fields.Bytes_Available != ð)
{
if (memcmp(error_code.ec_fields.Exception_Id,"CPF3C1E",7)==ð)
{
printf("\nFAILED WITH CPF3C1E:");
temp_ptr=&(error_code.exception_data);
parm_number=\((int \)temp_ptr);
printf("\n Parameter number omitted: %d",parm_number);
}
else
{
printf("ATTEMPT TO REGISTER EXIT POINT FAILED WITH EXCEPTION: %.7s",
error_code.ec_fields.Exception_Id);
exit(1);
}
}
Error Handling Signaled by API
The second means of exception handling is by having all exceptions signaled by
the API to the calling program. To have all exceptions signaled by the API, set the
bytes provided field of the error code structure to zero. Refer to the documentation
of your specific programming language for information on exception handling.
4-6 System API Programming V4R1