Move Program Messages (QMHMOVPM) API


  Required Parameter Group:

1 Message key Input Char(4)
2 Message types Input Array of Char(10)
3 Number of message types Input Binary(4)
4 To call stack entry Input Char(*) or Pointer
5 To call stack counter Input Binary(4)
6 Error code I/O Char(*)

  Optional Parameter Group 1:

7 Length of to call stack entry Input Binary(4)
8 To call stack entry qualification Input Char(20)

  Optional Parameter Group 2:

9 To call stack entry data type Input Char(10)
10 From call stack entry address Input Char(16) or Pointer
11 From call stack counter Input Binary(4)

  Default Public Authority: *USE

  Threadsafe: Yes

The Move Program Message (QMHMOVPM) API moves messages from a call message queue in the call stack to the call message queue of an earlier call stack entry. Moving a message does not change the sender information stored with the message. However, moving an escape message automatically changes it to a diagnostic message.

You can use the QMHMOVPM API to pass messages up the call stack, transferring important information to a previous program. When messages are sent to a call stack entry and the program running in that entry ends without moving its messages up the stack, the programs left in the stack cannot receive those messages unless:

For example, assume a program is sent several diagnostic messages and one escape message in response to an error. Another program earlier in the stack can handle the error. If the first program uses the QMHMOVPM API to move all the diagnostic messages to the program earlier in the stack, it then uses the Resend Escape Message (QMHRSNEM) API to send the escape message to the calling program.

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


Authorities and Locks

None.


Required Parameter Group

Message key
INPUT; CHAR(4)

When moving a single, specific message, use the key to that message for this parameter. The key is assigned by the command or API that sends the message.

When using the message types parameter to move a group of messages, use blanks for this parameter.

Message types
INPUT; ARRAY of CHAR(10)

The type or types of the messages being moved.

When moving a group of messages, specify a list of one through four message types. You can use these values in the list to move all messages of one or more types:

*COMP Completion
*DIAG Diagnostic
*ESCAPE Escape. After an escape message is moved, its message type changes to diagnostic.
*INFO Informational

For descriptions of the message types, see Message Types.

If there are no messages of a type you specify, the QMHMOVPM API does not return an error. It simply returns control to the calling program.

If the number of message types parameter specifies 0, this parameter is ignored.

Number of message types
INPUT; BINARY(4)

The number of message types specified in the message types parameter.

When moving a single message by specifying the message key in the message key parameter, use 0 for the number of message types parameter.

If you use blanks for the message key parameter and specify one or more message types, the value must be 1 through 4.

To call stack entry
INPUT; CHAR(*) OR POINTER

The call stack entry to move 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 call stack entry specified must be in the call stack; you cannot specify the external message queue.

You can specify a call stack entry by:

If the call stack entry is identified by pointer, the pointer specified must address a valid call stack entry within the same job as the one the API is used in. Alternatively, the pointer can be set to Null. The Optional Parameter Group 1 must be used and the Length of To call stack entry parameter must be set to 16. In addition, the Optional Parameter Group 2 must also be used and the Call stack entry format parameter must be set to *PTR.

If the pointer provided is set to Null, this indicates that the call stack entry is the one in which the API is being used.

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

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:

Note: If the optional parameters Length of to call stack entry and To call stack entry data type are not specified, this parameter is assumed to be CHAR(10).

To call stack counter
INPUT; BINARY(4)

A number identifying the location in the call stack of the call stack entry to whose message queue the messages are to be moved. The number is relative to the call stack entry identified by the To call stack entry parameter. It indicates how many calls up the call stack the target entry is from the one identified by the To call stack entry parameter. Valid values follow:

0 Move the messages to the message queue of the entry specified by the to call stack entry parameter. You cannot use 0 when the to call stack entry parameter specifies *, a Null pointer, or a pointer that points to the user of the API. This combination means that you want to move the message from yourself to yourself which is not a valid operation.
1 Move the messages to the message queue of the call stack entry one earlier on the stack than the one identified by the To call stack entry parameter.
n (any positive
number)
Move the messages to the queue of the nth call stack entry earlier in the stack from the one identified by the To call stack entry parameter.

You can use any positive number that does not exceed the actual number of call stack entries in the call stack. Do not include the external message queue in your count.


Optional Parameter Group 1

Length of to call stack entry
INPUT; BINARY(4)

The length of the value for the to call stack entry parameter.

Valid values for this parameter are as follows:

Note: The actual length of the call stack entry name cannot exceed 4096 characters. If this parameter is not used, the value for the call stack entry parameter is assumed to be 10 characters in length.

To call stack entry qualification
INPUT; CHAR(20)

Further identifies 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 parameter are used as a qualifier for the value provided in the To call stack entry parameter. The values that can be specified here depend upon the value provided in the To call stack entry parameter.

The special values discussed with this parameter can be used to indicate that the module name qualifier or program name qualifier is not being specified:

If the To call stack entry parameter contains an ILE procedure name then this parameter can contain the name of the module and the ILE program to further qualify the procedure name. The first 10 characters specify the module name, and the second 10 characters specify the ILE program name. If this parameter is not used or if *NONE is specified for both qualifiers, only the specified procedure name is used to determine the call stack entry.

If the required To call stack entry parameter contains the key value *PGMNAME, then the program name qualifier must contain either an OPM program name or an ILE program name. For ILE, the module name qualifier may contain a module name; otherwise it must contain *NONE.

When the To call stack entry parameter contains the special value * or *CTLBDY, the Optional Parameter Group 1 should either not be used or both the module name and program name qualifiers must be specified as *NONE.

When the To call stack entry parameter contains an OPM program name, the Optional Parameter Group 1 should also either not be used or 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 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 special value *PGMBDY is used, the Optional Parameter Group 1 may be used. In this case, the module name qualifier must be specified as *NONE. For the program name qualifier, an OPM or ILE program name may be specified or *NONE may be used.

If the To call stack entry is identified by pointer, this parameter must still be passed to the API. The value specified for the module name qualifier must be specified as *NONE. The program name qualifier serves as a qualifier for the pointer and must be specified as one of the following special values:

*NONE The call stack entry addressed by the pointer is the one to which the message is to be moved or the one to start counting from when using a value other than 0 for the To call stack counter parameter.

*PGMBDY The call stack entry to move the message to or to start counting from is an ILE program boundary. The ILE program is the one which contains the procedure that is running in the call stack entry addressed by the pointer.

If the ILE program was called using a dynamic call, using this special value with a pointer will identify the call stack entry for the PEP of that program. If a call was made using a procedure pointer, it will identify the call stack entry for the procedure that was pointed to.

If the pointer addresses a call stack entry that is running a procedure from an ILE service program, this option can be used to identify the call stack entry for the first procedure that was called in that service program.

If the call stack entry addressed by the pointer is running an OPM program than using the special value *PGMBDY here will have the same effect as using *NONE in most cases. A difference will occur if the OPM program called itself recursively. In this case using *PGMBDY identifies the first recursion level while *NONE identifies the current recursion level.


Optional Parameter Group 2

Use these optional parameters when:

To call stack entry data type
INPUT; CHAR(10)

Whether the value of the To call stack entry parameter is a character string (a name or special value) or a pointer.

Use one of the following special values;

*CHAR Value of the parameter is a character string (name or special value)
*PTR Value of the parameter is a pointer.

If the above optional parameter is not specified, it is assumed that the value of the To call stack entry parameter is a character string.

From call stack entry address
INPUT CHAR(16) OR POINTER

A pointer to the call stack entry where the messages to be moved exist 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 program languages that do not support pointers, a Null pointer can be presented by using a 16 byte variable. The first byte of the variable is set to the special value * and the remaining 15 bytes set to blanks.

If the pointer provided is set to Null, this indicates the current call stack entry (the one using the API).

If the pointer is not a valid pointer or if it is a valid pointer but is not Null nor does it 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 where the messages to be moved exist. The number is relative to the To call stack entry that is addressed by the From call stack entry address pointer. It indicates how many calls up the call stack the entry is from the one that is addressed by the pointer. Valid values follow:

0 The message to move exists at the call stack entry that is addressed by the pointer.

1 The message to move exists at the call stack entry that is one earlier in the call stack than the one addressed by the pointer.

n (any positive number) The message to move exists at the nth call stack entry earlier in the stack from the one addressed by the pointer.

You can use any positive number that does not exceed the actual number of call stack entries in the call stack. Do not include the external message queue in your count.

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.


Error Messages

Message ID Error Message Text
CPF24A3 E Value for call stack counter parameter not valid.
CPF24A5 E Value of &1, for number of message types, not valid.
CPF24BF E Module or bound-program name is blank.
CPF24B3 E Message type &1 not valid.
CPF24B4 E Severe error while addressing parameter list.
CPF24B5 E Not able to move message.
CPF24B7 E Value &1 for call stack entry name length not valid.
CPF24B9 E When call stack entry name is '*' or '*CTLBDY', module name and program name must be '*NONE'.
CPF24C5 E Pointer to call stack entry not valid.
CPF24C6 E Value of To call stack entry data type parameter not valid.
CPF24C8 E Control boundary not found on call stack.
CPF24C9 E Program boundary not found on call stack.
CPF24CB E *PGMNAME requires a specified program name.
CPF24CC E Call stack entry &2 for *PGMNAME not found.
CPF24CD E Module name cannot be specified when *PGMBDY is used.
CPF24CE E Qualifier &1 incorrect for use with pointer.
CPF241B E Message type &1 in system program is not valid.
CPF2410 E Message key not found in message queue &1.
CPF247A E Call stack entry not found.
CPF2471 E Length of field not valid.
CPF2479 E Call stack entry not found.
CPF2508 E Cannot move messages to same or later call stack entry.
CPF2509 E Message key &2 refers to a message that is not on the mover's call stack entry.
CPF3C90 E Literal value cannot be changed.
CPF3CF1 E Error code parameter not valid.
CPF3C36 E Number of parameters, &1, entered for this API was not valid.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


API introduced: V2R1.1

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