Resend Escape Message (QMHRSNEM) API


  Required Parameter Group:


  Optional Parameter Group:


  Default Public Authority: *USE

  Threadsafe: Yes

The Resend Escape Message (QMHRSNEM) API resends an escape message from the current call stack entry to the previous call stack entry in the call stack or to any call stack entry that is earlier if the optional parameters are used. This API can also be used to resend an escape message from a call stack entry other than the current one.

You can use this API along with the Move Program Messages (QMHMOVPM) API to streamline exception message handling. If a call stack entry is sent diagnostic messages and an escape message but cannot handle the error itself, you can use the QMHMOVPM API to move the diagnostic messages. You can use the QMHRSNEM API to forward the escape message to the previous call stack entry in the call stack. The call stack entry does not need to send an escape message of its own. For details about the QMHMOVPM API, see Move Program Messages (QMHMOVPM) API.

In a multithreaded job messages can be resent only from one call message queue to another call message queue within the thread that calls this API. Messages cannot be resent to a call stack entry in another thread.


Authorities and Locks

None.


Required Parameter Group

Message key
INPUT; CHAR(4)

The key to the escape message being resent. The key is assigned by the command or API that first sends the message.

To resend the last new escape message, use blanks for this parameter.

A message is new until it is received. It then becomes an old message. You can resend an old message only if you specify the message key.

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


Optional Parameter Group

Use these optional parameters if the call stack entry, to which the message is to be resent, is not just previous to the one that is using this API. Use these optional parameters also when the message to resend is not on the current call stack entry's message queue.

To call stack entry
INPUT; CHAR(*)

A structure that contains the information that this API will use to determine the call stack entry to resend the message to. The structure can be in one of two formats; RSNM0100 or RSNM0200.

To call stack entry length
INPUT; BINARY(4)

The length of the To call stack entry parameter. The length specified here must be at least large enough to hold the specified format of the To call stack entry parameter. It may be larger. In case it is larger, the structure must be left justified in the area. If the length specified by this parameter is not adequate for the format being used, error CPF24C7 is sent to the caller of this API.

Format of to call stack entry parameter
INPUT; CHAR(8)

The format of the to call stack entry parameter. Use one of the following format names:


From call stack entry address
INPUT; Pointer or CHAR(16)

A pointer to the call stack entry where the escape message to resend exists or the call stack entry to start counting from if the From call stack counter is not 0.

The pointer that is specified must be an invocation pointer that addresses a valid call stack entry or must be set to Null.

For programming languages that do not support pointers, a Null pointer can be represented by a 16 byte variable in which the first byte is set to the special value '*' and the remaining 15 bytes are set to blanks.

If the pointer provided is set to Null, this indicates the current call stack entry.

If the pointer is not Null or it does not address a valid call stack entry, the error message CPF24C5 is sent to the user of the API.

From call stack counter
INPUT; BINARY(4)

A number identifying the location in the call stack of the call stack entry from where the message is to be resent. The number is relative to the from call stack entry that is addressed by the pointer. It indicates how many calls earlier in the call stack the entry is from the one that is addressed by the pointer. Valid values follow:

RSNM0100 Format

The following table shows the structure of the To call stack entry parameter when the RSNM0100 format is used. This format is used when the to call stack entry is identified by name or by special value.

The information passed in the RSNM0100 format is described in Field Descriptions.



RSNM0200 Format

The following table shows the structure of the To call stack entry parameter when the RSNM0200 format is used. This format is used when the to call stack entry is identified by a pointer.

The information passed in the RSNM0200 format is described in Field Descriptions.



Field Descriptions

Length of the to call stack entry identifier. The length of the To call stack entry identifier. Valid values for this parameter are as follows:

Note: The actual length of the call stack entry name cannot exceed 4096.

Pointer qualifier. Specify one of the following special values:

To call stack counter. A number identifying the location in the call stack of the call stack entry to which the message is to be resent. The number is relative to the call stack entry identified by the To call stack entry identifier field. It indicates how many calls up the call stack the target entry is from the one specified in the To call stack entry identifier field. Valid values follow:

The From call stack entry cannot be the same as the To call stack entry. Additionally, the To call stack entry must be earlier on the call stack than the From call stack entry.

To call stack entry address. A pointer to the call stack entry to resend the messages to, or the call stack entry to start counting from when using a value other than 0 for the To call stack counter parameter.

The pointer that is specified must be an invocation pointer that addresses a valid call stack entry or must be set to Null.

If the pointer provided is Null, this indicates the current call stack entry. If a Null pointer is provided, the To call stack counter parameter must be specified as a non-zero value.

If the pointer provided is not Null and does not address a valid call stack entry, the error message CPF24C5 is sent to the user of the API.

To call stack entry identifier. An identification of the call stack entry to resend the message to or the call stack entry to start counting from when using a value other than 0 for the To call stack counter parameter. The call stack entry identified by this field must be in the call stack, and you cannot specify the external message queue.

You can identify the To call stack entry by providing the name of the OPM program or ILE procedure running in the entry or by using one of the following special values:

The call stack entry can be a nested procedure name from 1 through 4096 characters in length. When specifying nested procedures, each procedure name must be separated by a colon, and the outermost procedure is identified first followed by the procedures it contains. The innermost procedure is the last procedure identified in the string.

The call stack entry can be a partial name. To specify a partial name, place three less-than signs (<<<) at the beginning of the call stack entry identifier, or place three greater-than signs (>>>) at the end of the call stack entry identifier, or place both the less-than signs and the greater-than signs at their respective ends of the call stack entry identifier. The value for the call stack entry excluding the less-than signs and the greater-than signs is used to search backward through the stack for the requested call stack entry name.

When searching for a partial call stack entry name:

To call stack entry qualification. This field is used when it is necessary to further identify the To call stack entry. The parameter consists of two 10 character parts. The first part is the module name qualifier and the second part is the program name qualifier. The values provided in this field are used as a qualifier for the value provided in the To call stack entry identifier field. The values that can be specified here depend upon the value provided as the To call stack entry identifier.

The following special value may be used to indicate that the module name qualifier or program name qualifier is not being specified:

If the To call stack entry identifier field contains an ILE procedure name then this field can contain the name of the module and program that the procedure was compiled and bound into. The module and program name qualifiers are used to distinguish the correct call stack entry in the case where different procedures of the same name are on the call stack at the same time. The first 10 characters specify the module name, and the second 10 characters specify the ILE program name or ILE Service program name. If *NONE is specified for both the module and program name qualifiers, only the specified procedure name is used to determine the call stack entry.

If the To call stack entry identifier field contains the special value *PGMNAME than the program name qualifier must contain either an OPM program name or an ILE program or Service program name. For ILE, the module name qualifier may contain a module name; otherwise it must contain *NONE.

When the To call stack entry identifier field contains the special value * or *CTLBDY, both the module name qualifier and program name qualifier must be specified as *NONE.

When the To call stack entry identifier field contains an OPM program name, both the module name and program name qualifiers should be specified as *NONE. If a module name or program name is specified here, the name specified as the To call stack entry identifier is interpreted as an ILE procedure name rather than an OPM program name. Either the entry would not be found or an incorrect entry would be found.

When the To call stack entry identifier field contains the special value *PGMBDY, the module name qualifier must be specified as *NONE. For the program name qualifier, an OPM, ILE program, or ILE Service program name may be specified or *NONE may be used.


Error Messages



API introduced: V2R1.1

[ Back to top | Message Handling APIs | APIs by category ]