This procedure receives message to program from call stack entry.
Parameter | Type | Description | |
---|---|---|---|
callStackEntry | 4096A | Mandatory | Call stack entry. The program name from call stack to which the message was sent. |
msgKey | 4A | Mandatory | Unique message key of message. Input/Output parameter. Used to loop thorugh all messahges. It can be unique message number of special value *TOP. The receivePgmMsg function will receive first message after message with mesgKey provided. |
msgType | 10A | Optional | Type of message to receive. If not provided the value is defaulted to *NEXT. See QMHRCVPM api descriptin form IBM. |
msgAction | 10A | Optipnal | Action to take after message is received. Valid values are *OLD, *SAME, *REMOVE. The default value is: *SAME. See QMHRCVPM api descriptin form IBM. |
callStackCount | 10I 0 | Optional | Call stack counter A number identifying the location in the call stack of the call stack entry to whose message queue the message is to be sent. The number is relative to the call stack entry identified by the Call stack entry parameter. It indicates how many calls up the call stack the target entry is from the one identified by the Call stack entry parameter. it could be 0 or any positive number. |
callStackEntryLen | 10I 0 | Optional | Length of call stack entry The length of the value for the Call stack entry parameter. See QMHSNDPM IBM API for more details. |
callStackEntryQual | 20A | Optional | Call stack entry qualification. This parameter is used when it is necessary to further identify the 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. See QMHSNDPM IBM API for more details. |
Procedure returns message info data structure (see data structure description bellow).
Field | Type | Description |
---|---|---|
msgId | 7A | Id of message |
msgText1 | * | Pointer to first level text of message. |
msgText1Len | 10I 0 | Length of first level text. |
msgText2 | * | Pointer to second level text of message. |
msgText2Len | 10I 0 | Length of second level text. |
msgFields | 1024A | fields names coma separated which are connected to message. |
msgType | 10A | Type of message. |
Examples:
//Definition of variables
D dsMsgInfo DS likeds(msgInfo_template)
D lMsgKey S 4a
//Receive one message from call srtack of program MGRR0001
lMsgKey = "*TOP";
dsMsgInfo = receivePgmMsg("MGRR0001" : lMsgKey);
//Loop trough all messates
lMsgKey = "*TOP";
dsMsgInfo = receivePgmMsg("MGRR0001" : lMsgKey);
dow dsMsgInfo.msgText1Len > 0;
// ener your code here....
dsMsgInfo = receivePgmMsg(callStackEntry :lMsgKey);
enddo;