The MQACH structure describes the header information that must be present at the start of each exit chain area.
Any exit function can create a chain area in dynamically-obtained storage (for example, by using malloc), and add that area to the chain at the desired location (start, middle, or end). The exit function must ensure that it sets all fields in MQACH to valid values.
The exit suite which creates the chain area is responsible for destroying that chain area prior to termination (the MQ_TERM_EXIT function is a convenient point at which to do this). However, adding and removing chain areas from the chain must only be done by an exit function when it is invoked by the queue manager; this restriction is necessary to avoid serialization problems.
Exit chain areas are made available to all exit suites, and should not be used to hold private data. Use ExitUserArea in MQAXP to hold private data.
In general there is no correspondence between the chain of exit functions that are invoked for an API call, and the chain of exit chain areas:
This structure is supported in the following environments: AIX, HP-UX, Solaris, Linux, and Windows.
The MQACH structure contains the following fields:
Structure identifier.
For the C programming language, the constant MQACH_STRUC_ID_ARRAY is also defined; this has the same value as MQACH_STRUC_ID, but is an array of characters instead of a string.
This initial value of this field is MQACH_STRUC_ID.
Structure version number.
The following constant specifies the version number of the current version:
Note: | When a new version of the MQACH structure is introduced, the layout of the existing part is not changed. The exit function should therefore check that the version number is equal to or greater than the lowest version which contains the fields that the exit function needs to use. |
The initial value of this field is MQACH_CURRENT_VERSION.
Length of MQACH structure.
This is the length of the MQACH structure itself; this length excludes the exit-defined data that follows the MQACH structure (see the ChainAreaLength field).
The following value is defined:
The following constant specifies the length of the current version:
The initial value of this field is MQACH_CURRENT_LENGTH.
Total length of chain area.
This is the total length of the chain area. It is equal to the sum of the length of the MQACH plus the length of the exit-defined data that follows the MQACH.
The initial value of this field is zero.
Exit information name.
This is a name that is used to identify the exit suite to which the chain area belongs.
The length of this field is given by MQ_EXIT_INFO_NAME_LENGTH. The initial value of this field is the null string in C.
Address of next MQACH structure in chain.
This is the address of the next chain area in the chain. If the current chain area is the last one in the chain, NextChainAreaPtr is the null pointer.
The initial value of this field is the null pointer.
typedef struct tagMQACH MQACH; struct tagMQACH { MQCHAR4 StrucId; /* Structure identifier */ MQLONG Version; /* Structure version number */ MQLONG StrucLength; /* Length of MQACH structure */ MQLONG ChainAreaLength; /* Total length of chain area */ MQCHAR48 ExitInfoName; /* Exit information name */ PMQACH NextChainAreaPtr; /* Address of next MQACH structure in chain */ };