The <except.h> include file declares types
and macros that are used in ILE C exception handling.
The definition of _INTRPT_Hndlr_Parms_T is:
typedef _Packed struct {
unsigned int Block_Size;
_INVFLAGS_T Tgt_Flags;
char reserved[8];
_INVPTR Target;
_INVPTR Source;
_SPCPTR Com_Area;
char Compare_Data[32];
char Msg_Id[7];
char reserved1;
_INTRPT_Mask_T Mask;
unsigned int Msg_Ref_Key;
unsigned short Exception_Id;
unsigned short Compare_Data_Len;
char Signal_Class;
char Priority;
short Severity;
char reserved3[4];
int Msg_Data_Len;
char Mch_Dep_Data[10];
char Tgt_Inv_Type;
_SUSPENDPTR Tgt_Suspend;
char Ex_Data[48];
} _INTRPT_Hndlr_Parms_T;
Element
Description
Block_Size
The size of the parameter block passed to the exception handler.
Tgt_Flags
Contains flags that are used by the system.
reserved
An eight byte reserved field.
Target
An invocation pointer to the call stack entry that enabled the
exception handler.
Source
An invocation pointer to the call stack entry that caused the
exception. If that call stack entry no longer exists, then this is
a pointer to the call stack entry where control resumes when the exception
is handled.
Com_Area
A pointer to the communications area variable specified as the
second parameter on the #pragma exception_handler. If a
communication area was not specified, this value is NULL.
Compare_Data
The compare data consists of 4 bytes of message prefix, for
example CPF, MCH, followed by 28 bytes which are taken from the message
data of the related message. In the case where the message data is
greater than 28 these are the first 28 bytes. For MCH messages, these
are the first 28 bytes of the exception related data that is returned
by the system (substitution text).
Msg_Id
A message identifier, for example CPF123D. *STATUS message types
are not updated in this field.
reserved1
A 1 byte pad.
Mask
This is an 8-byte exception mask, identifying the type of the
exception that occurred, for example a decimal data error. The possible
types are shown in Table 20.
Msg_Ref_Key
A key used to uniquely identify the message.
Exception_Id
Binary value of the exception id, for example, 0x123D. To display
value, use conversion specifier %x as information is stored
in hex value.
Compare_Data_Len
The length of the compare data.
Signal_Class
Internal signal class.
Priority
The handler priority.
Severity
The message severity.
reserved3
A 4-byte reserved field.
Msg_Data_Len
The length of available message data.
Mch_Dep_Data
Machine-dependent data.
Tgt_Inv_Type
Invocation type. Macros are defined in <mimchobs.h>.
The size of the parameter block passed to the cancel handler.
Inv_Flags
Contains flags that are used by the system.
reserved
An eight byte reserved field.
Invocation
An invocation pointer to the invocation that is being cancelled.
Com_Area
A pointer to the handler communications area defined by the
cancel handler.
Mask
A 4 byte value indicating the cancel reason.
The following built-ins are defined in <except.h>:
Built-in
Description
__EXBDY
The purpose of the __EXBDY built-in or _EXBDY macro is to act
as a boundary for exception-sensitive operations. An exception-sensitive
operation is one that may signal an exception. An EXBDY enables programmers
to selectively suppress optimizations that do code motion. For example,
a divide is an exception-sensitive operation because it can signal
a divide-by-zero. An execution path containing both an EXBDY and a
divide will perform the two in the same order with or without optimization.
For example:
b = exp1;
c = exp2;
...
_EXBDY();
a = b/c;
__VBDY
The purpose of a __VBDY built-in or _VBDY macro is to ensure
the home storage locations are current for variables that are potentially
used on exception paths. This ensures the visibility of the current
values of variables in exception handlers. A VBDY enables programmers
to selectively suppress optimizations, such as redundant store elimination
and forward store motion to enforce sequential consistency of variable
updates. In the following example, the VBDYs ensure that state is
in it's home storage location before each block of code that may signal
an exception. A VBDY is often used in combination with an EXBDY to
ensure that earlier assignments to state variables really update home
storage locations and that later exception sensitive operations are
not moved before these assignments.
state = 1;
_VBDY();
/* Do stuff that may signal an exception. */
state = 2;
_VBDY();
/* More stuff that may signal an exception. */
state = 3;
_VBDY();
For more information about built-ins, see
the ILE C/C++ for AS/400 MI Library Reference .