Group message 2 (-GRP2)
Use the Group Message 2 adapter command (-GRP2) for data sources to specify retrieval of message groups and non-group messages from the source queue.
-GRP2
The -GRP2 adapter command enables better control over group messages than the -GRP adapter command. The biggest difference between the -GRP2 and -GRP adapter commands is that -GRP2 can be used to process multiple message groups on the source queue. In addition to this, message groups are processed as a unit with -GRP2 and not as individual messages.
While the -GRP adapter command detects a group on the queue and then starts retrieving messages that belong only to that group, the -GRP2 adapter command detects a group on the queue, retrieves all the messages from that group in a single block of data, and keeps looking for other message groups on the queue and other individual non-group messages.
The following restrictions apply to the -GRP2 adapter command:
- It has no arguments.
- It can only be used on input (input cards and GET map function).
- It cannot be combined with the -GRP adapter command.
- It assumes usage of the -XGRP, -ALLSEG, and -ALLMSG adapter commands. Whether explicitly specified or not, these three adapter commands will be automatically included by the -GRP2 adapter command.
- It can be used with the -EQMN and -EQN adapter commands. In case of an error, all messages from the retrieved groups as well as all retrieved non-group messages are moved to the specified error queue.
- in the Launcher scenario, it can be combined with the -REFRESH adapter command. This is particularly useful when there is a possibility that an incomplete message group gets skipped by the queue cursor in order to obtain another complete message group (or non-group message), and the skipped group later becomes complete.
The following table lists some examples of the -GRP2 adapter command usage.
Presume that the following content of queue QUEUE1 is defined under queue manager QMNAME:
Message ID | Message in a group? | Group ID | Logical Sequence Number | Last message in the group? | Segmented message? | Offset | Last Segment? | Data |
---|---|---|---|---|---|---|---|---|
1 | NO | PhysMess01 | ||||||
2 | YES | 1 | 1 | NO | NO | PhysMess02 | ||
3 | YES | 1 | 2 | YES | NO | PhysMess03 | ||
4 | NO | PhysMess04 | ||||||
5 | YES | 1 | 3 | NO | NO | PhysMess05 | ||
6 | YES | 2 | 1 | NO | NO | PhysMess06 | ||
7 | NO | PhysMess07 | ||||||
8 | NO | PhysMess08 | ||||||
9 | YES | 2 | 2 | NO | YES | 0 | NO | PhysMess09 |
10 | YES | 2 | 2 | NO | YES | 10 | NO | PhysMess10 |
11 | YES | 2 | 2 | NO | YES | 20 | YES | PhysMess11 |
12 | YES | 2 | 3 | YES | NO | PhysMess12 | ||
13 | YES | 3 | 1 | YES | NO | PhysMess13 | ||
14 | NO | PhysMess14 |
There are few important things to note in this table:
- Physical messages on positions 1, 4, 7, 8 and 14 are logical messages that do not belong to any group.
- Physical messages on positions 2, 3 and 5 are logical messages that belong to a group with the group ID equal to "1".
- Physical messages on positions 6, 9, 10, 11 and 12 belong to a group with the group ID equal to "2". Physical messages on positions 6 and 12 are logical messages, and physical messages on positions 9, 10 and 11 are message segments that together form a single logical message. Physical message on position 11 is the last segment of the logical message. Physical message on position 12 is the last logical message of the group.
- Physical message on position 13 is a logical message and it belongs to a group with the group ID equal to "3". This message is the only logical message in the group.
Presume that a map has one input card and one output card. The input card is of IBM® MQ type, and the output card is of "File" type. The data content obtained in the input card is stored to a file specified in the output card.