Japanese

Practical mastering IBM MQ basics

Message descriptor (MQMD) (2)

*This series may be revised based on the latest mqpgf/mqpcf. Please always download and use the latest version.

[ Expiry ]

Type: MQLONG
Size: 4 bytes
Initial value: MQEI_UNLIMITED(-1)
Input / output: MQGET(): Output, MQPUT(): Input

It is the duration of a message. Specify in units of 100 ms at MQPUT(). By default, MQEI_UNLIMITED (-1) is set and the duration is unlimited. The value returned at MQGET() is the remaining time of the expiration time subtracted. When relaying a message, if you pass through the value received by MQGET() at the time of MQPUT(), it can be used as an expiration time of the period when the message flows through the system. (Depending on the design, each MQMD value is often passed by the relay process.)


Ex. 2.1 Confirmation of the timing of deletion for expired messages

Set Expiry to MQPUT() on SampleQM and check the value on RemoteQM. Set a value in units of 100 ms following "-ex".

*From here, the note on the command execution location is omitted. If SampleQM and RemoteQM are on different machines or on different installation environments, determine where to execute the command based on the queue manager name specified in "-qm".


Test result 2.1.1

$ mqpgf -qm SampleQM -q RemoteQ -m "expiry test message" -ex 100
[18/02/20 18:56:52] 1: message length: 19 put message : expiry test message

$ mqpgf -qm RemoteQM -q RemoteQ -br
message number: 1
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[47] ....
....

$ mqpgf -qm RemoteQM -q RemoteQ -br
message number: 1
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[16] ....
....

$ mqpgf -qm RemoteQM -q RemoteQ -br
no message available : RemoteQ CompCd=02 ReasonCd=2033

*Option descriptions
-ex: Duration of message (in 100 ms units)

Every time you browse the contents of the message, the Expiry value is subtracted, and after 10 seconds, you can confirm that the message is erased and can not be referenced. The reason code "2033" means MQRC_NO_MSG_AVAILABLE and indicates that the message was not on the queue when MQGET() was issued. At this time, the completion code is set to "2" (MQCC_FAILED), so it may be misunderstood that something went wrong, but it only indicates that there was no message to retrieve. When an expired message remains in the queue without being purged, even if you issue MQGET(), no other special situation occurs.

Describes when messages are discarded from the queue for messages whose duration has expired. It is deleted(Queue status property CURDEPTH become '0') when MQGET () is issued, but if MQGET () is not executed, the queue manager checks and deletes messages whose duration has expired periodically. This cycle is not the time since the duration time has expired, but is the cycle that the queue manager has internally. For example, in MQ9.0 for Windows, it is deleted in 5-minute cycle (0-5 minutes), and in MQ5.3 for HPNonStop, it is deleted in 1-minute cycle (0-1 minute).
Check this situation.


Test result 2.1.2

First, execute the mqpcf's ques (Inquire Queue Status) command continuously at intervals of 10 seconds ("-i 10"), display the execution time ("-t"), and specify CURDEPH to be displayed.
$ mqpcf ques -qm SampleQM -q SampleQ -i 10 -t CURDEPTH
[18/02/20 19:53:51] 1: QUEUE(SampleQ) TYPE(QUEUE) CURDEPTH(0)
[18/02/20 19:54:01] 1: QUEUE(SampleQ) TYPE(QUEUE) CURDEPTH(0)
....
PUT a message with 10 seconds of Expiry as before from any other terminal / command prompt.
$ mqpgf -qm SampleQM -q SampleQ -m "expiry test message" -ex 100
[18/02/20 19:54:04] 1: message length: 19 put message : expiry test messagee

It can be confirmed that CURDEPTH becomes "0" within 5 minutes (in the case of MQ 9.0 for Windows) from the output of mqpcf.
[18/02/20 19:54:11] 1: QUEUE(SampleQ) TYPE(QUEUE) CURDEPTH(1)
....
[18/02/20 19:57:42] 1: QUEUE(SampleQ) TYPE(QUEUE) CURDEPTH(1)
[18/02/20 19:57:52] 1: QUEUE(SampleQ) TYPE(QUEUE) CURDEPTH(0)

*Option descriptions (mqpcf)
-i: Repeat execution interval (seconds)
-t: Display execution time

fig 2.1

[ Feedback ]

Typ: MQLONG
ize: 4 bytes
Initial value: MQFB_NONE (0)
Input / output: MQGET (): Output, MQPUT (): Input

This field was briefly described in the Report field section, and we confirmed the case where MQFB_COA and MQFB_COD are set in "Test Result 1.3.2". The Feedback field is used when MQMD.MsgType is MQMT_REPORT, but in the case of an exception report, etc., the reason code of MQ is set, and various values are set depending on the situation. As it indicates the cause of the problem that occurred, be sure to output to the application log etc for the cause investigation. Please check the product manual for details of the reason code.


Ex. 2.2 Confirmation of the case in which the reason code is set to Feedback in the exception report

Check the case where the reason code is set in the exception report.


Test result 2.2

Set the destination queue to write protection.
$ mqpcf put disable -qm RemoteQM -q RemoteQ
Put Disabled : RemoteQ

Make sure that writing is prohibited.
$ mqpcf que -qm RemoteQM -q RemoteQ PUT
1: QUEUE(RemoteQ) TYPE(QLOCAL) PUT(DISABLED)

Sends a message to a write-protected queue.
$ mqpgf -qm SampleQM -q RemoteQ -m "mqmd.Feadback test" -rq ReportQ MQRO_EXCEPTION MQMT_REQUEST
[18/02/21 19:00:09] 1: message length: 18 put message : mqmd.Feadback test

Check the report message returned to the queue set to ReplyToQ.
$ mqpgf -qm SampleQM -q ReportQ -br
message number: 1
*StrucId[MD ] Version[2] Report[0] MsgType[4] Expiry[-1] Feedback[2051] ....
....
Use the mqrc command to check the meaning of the reason code set to Feedback. MQRC_PUT_INHIBITED indicates that PUT could not be performed because it was write protected.
$ mqrc 2051
2051 0x00000803 MQRC_PUT_INHIBITED

When the test is complete, change the setting back to write enabled.
$ mqpcf put enable -qm RemoteQM -q RemoteQ
Put Enabled : RemoteQ

*Option descriptions (mqpcf)
put {enable | disable}: Execute the "Change Queue" command and set the write to disable or allow
que: Execute "Inquire Queue" command
PUT: Display PUT field

*Option descriptions (mqpgf)
MQRO_EXCEPTION: Generate exception report

fig 2.2

[ Encoding ]

Type: MQLONG
Size: 4 bytes
Initial value: MQENC_NATIVE (depends on system)
Input / output: At MQGET(): Output (However, input / output field when MQGMO_CONVERT option is specified), At MQPUT(): Input

Encoding is assigned "Binary Integers", "Packed Decimal Integers", and "Floating Point Numbers" from the bottom every 4 bits. And it shows whether they are "NORMAL" or "REVERSED" for each of them. However, there is usually little awareness of these three numeric forms. A value representing a different encoding scheme for each system is set to the default MQENC_NATIVE. For example, in the case of a system of x86 CPUs such as Windows, MQENC_NATIVE is 0x00000222 (decimal number 546) and all REVERSED. In the case of HPNonStop, 0x00000111 (decimal number 273) is all NORMAL. In this way, it may be necessary to convert encodings when exchanging messages between different systems. (The encoding conversion will be described later.)

[ CodedCharSetId ]

Type: MQLONG
Size: 4 bytes
Initial value: MQCCSI_Q_MGR (value of CCSID field of queue manager, system locale for MQ client application)
Input / output: At MQGET(): Output (However, input / output field when MQGMO_CONVERT option is specified), At MQPUT(): Input

If the default MQCCSI_Q_MGR is specified in this field, the CCSID set in the queue manager's CCSID property is set. When you create a queue manager, this value is set according to the locale of that system. The queue manager's CCSID can be changed to any other CCSID supported by that platform. For MQ client applications, it is determined from the locale of the system on which the application is running. (The MQ client will be explained separately.) The value of the CodedCharSetId field of MQMD indicates the character code of the first header or data of the message body. Although often misunderstood, it does not indicate the character code of MQMD itself. The character code of MQMD specified in MQGET() and MQPUT() must use the character code set in the queue manager CCSID regardless of the setting value of CodedCharSetId of MQMD. For example, on Windows operating with Shift-JIS (code page 932), when sending an EBCDIC message exceptionally, MQMD is created by code page 932 and passed to MQPUT (), and it specify , for example, code page 930 which indicates Japanese EBCDIC to the CodedCharSetId of MQMD. When exchanging messages between different systems, conversion of character code may be required. (Character code conversion will be described later.)

[ Format ]

Type: MQCHAR8
Size: 8 bytes
Initial value: MQFMT_NONE (space of 8 bytes)
Input / output: At MQGET(): Output (However, input / output field when MQGMO_CONVERT option is specified), At MQPUT(): Input

You can set an arbitrary name indicating the format of the message using upper case letters and numbers. However, strings beginning with "MQ" can only be used predefined ones by Qmgr. It can also be the name of a user-created "data transformation exit" object. If you use a predefined name, specify one that correctly describes the format of the first header of the message body and the data. Some predefined names indicate the messages and format that the queue manager normally creates. The format often used is:

Format name Format description Data conversion
MQFMT_NONE Data nature is undefined (default) ×
MQFMT_STRING String
MQFMT_ADMIN Request to command server
MQFMT_DEAD_LETTER_HEADER Dead Letter Header
MQFMT_EVENT Event message 〇(Ver2 is z/OS only)
MQFMT_MD_EXTENSION Message descriptor extension
MQFMT_PCF User-defined PCF message
MQFMT_RF_HEADER_2 Rules and formatting header 2
MQFMT_TRIGGER Trigger message

As shown in this table, data conversion is possible with string only data, predefined headers and PCF formatted messages such as MQFMT_ADMIN and MQFMT_EVENT. The target of data conversion is both numeric encoding and character code. Code conversion is possible even when multiple character codes are mixed in a user-defined PCF. There are two methods for code conversion in MQ: data conversion by specifying the MQGMO_CONVERT option at the time of MQGET() call, and method by setting "YES" to the CONVERT property of the sender channel and causing the sender channel to perform conversion. In the case of data conversion on a channel, data conversion is performed before sending a message (when the channel program GETs a message from the transmission queue). Therefore, the message of the character code of the other party (non-readable) does not appear both on the source and destination queues. This means that it is not necessary to be aware (handle) of the character code of the other party in order to confirm the contents of the message on the queue at the time of failure etc. Therefore, consider conversion of the sender channel as much as possible. If a message is passed from the MQ client application in a different character code to the server side, conversion by the server side application is required. When converting with MQGMO_CONVERT at MQGET(), conversion is performed between CodedCharSetId of MQMD and CodedCharSetId of MQMD specified as input at MQGET(). When converting with the CONVERT (YES) property of the channel, conversion is performed between CodedCharSetId of the built-in MQMD (described later) and the CCSID property of the destination (transmission destination) queue manager.

Try to test these two methods in a simple example.


Ex. 2.3 Data conversion in channels

First, try to convert by channel.
Set the queue manager's CCSID as follows for testing.

SampleQM: 932(Shift-JIS)
RemoteQM: 1208(UTF-8)

*The above CCSD may not be able to be set depending on your environment. For example, when setting a CCSID of EBCDIC to a queue manager on an open machine. Also, if code conversion is not supported, the channel may not be connected. Check the MQ Knowledge Center for details on available CCSID and code conversion support.

The data to be tested uses full-width "ABC".

Shift-JIS UTF-8
A: 0x8260 0xEFBCA
B: 0x8261 0xEFBCA2
C: 0x8262 0xEFBCA3

Set the queue manager CCSID.

<< Working with SampleQM >>

alter qmgr ccsid(932)
2 : alter qmgr ccsid(932)
AMQ8005: The IBM MQ queue manager has changed.

dis qmgr ccsid
15 : dis qmgr ccsid
AMQ8408: Display the contents of the queue manager.
QMNAME(SampleQM)


<< Working with RemoteQM >>

MQSC > alter qmgr ccsid(1208)
6 : alter qmgr ccsid(1208)
AMQ8005: IBM MQ queue manager changed.

AMQ8408: Display Queue Manager details.
QMNAME(RemoteQM) CCSID(1208)

Although it is not directly related to this test, if you change the queue manager CCSID, the command server needs to be restarted.

$ endmqcsv
IBM MQ command server ending.
IBM MQ command server ended.

$ strmqcsv
IBM MQ command server started.

*As a precaution, you may want to restart the queue manager for the changes to take effect completely.

Set the channel's CONVERT property to YES. You need to restart the channel to enable it.

$ mqpcf stp -qm SampleQM -c SampleQM.TO.RemoteQM
Channel Stop Success. Channel Name : SampleQM.TO.RemoteQM Connection Name : Queue Manager :

alter chl('SampleQM.TO.RemoteQM') chltype(sdr) convert(yes)
3 : alter chl('SampleQM.TO.RemoteQM') chltype(sdr) convert(yes)
AMQ8016: IBM MQ channel has changed.

dis chl('SampleQM.TO.RemoteQM') convert
4 : dis chl('SampleQM.TO.RemoteQM') convert
AMQ8414: Display the contents of the channel.
CHANNEL(SampleQM.TO.RemoteQM) CHLTYPE(SDR)
CONVERT(YES)

Before converting the data in the transmission queue, leave the channel down to check the data.

PUT full-width "ABC" in Shit-JIS hexadecimal notation.

$ mqpgf -qm SampleQM -q RemoteQ -mx 826082618262 MQFMT_STRING
[18/02/28 16:12:21] 1: message length: 6 put message : 0x826082618262

*Option descriptions
-mx: Input message (hexadecimal notation)

Check PUT messages on the transmission queue. Since the transmission queue is normally set to prohibit reading, change it to read permission before browsing.

$ mqpcf get enable -qm SampleQM -q RemoteQM
Get Enabled : RemoteQM

$ mqpgf -qm SampleQM -q RemoteQM -brv
message number: 1
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[546] CodedCharSetId[932] Format[MQXMIT ] Priority[0] Persistence[0] MsgId[0x414D512053616D706C65514D20202020CA52965A258FD603] CorrelId[0x414D512053616D706C65514D20202020CA52965A258FD602] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x16010515000000DBEB0C50B47B733407E53B2B8433260000000000000000000B] ApplIdentityData[ ] PutApplType[7] PutApplName[SampleQM ] PutDate[20180228] PutTime[07122197] ApplOriginData[ ]
GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]
*StrucId[XQH ] Version[1] RemoteQName[RemoteQ ] RemoteQMgrName[RemoteQM ]
*StrucId[MD ] Version[1] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[546] CodedCharSetId[932] Format[MQSTR ] Priority[0] Persistence[0] MsgId[0x414D512053616D706C65514D20202020CA52965A258FD602] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x16010515000000DBEB0C50B47B733407E53B2B8433260000000000000000000B] ApplIdentityData[ ] PutApplType[11] PutApplName[\cprog\win\mqpgf14\mqpgf.exe] PutDate[20180228] PutTime[07122197] ApplOriginData[ ]

data length: 434
00000000: 8260 8261 8262 'ABC '

Messages in the transmission queue have the following format:

[Independent MQMD (separate MQMD)] (+) [Transmission queue header] + [Embedded MQMD (embedded MQMD)] + [User message]
Independent message descriptors is generated by the queue manager, and embedded message descriptors is the application-specified MQMD.

Check the Encoding, CodedCharSetId, Format and data of the built-in MQMD (the second MQMD). The sample test is as follows.

Encoding: 546(REVERCED)(for x86 CPUs)
CodedCharSetId: 932(Shift-JIS)
Format: MQSTR (string)
data: 0x8260 8261 8262 (Shift-JIS full-size "ABC")

*data length is the sum of the following.

Transmission queue heade: 104Byte
Embedded MQMD (V1) Length: 324Byte
Message length (3 (character) * 2 (DBCS): 6Byte

Start a channel and have it send messages on the transmission queue.

$ mqpcf sta -qm SampleQM -c SampleQM.TO.RemoteQM
Channel Start Success. Channel Name : SampleQM.TO.RemoteQM

Display the message in browse mode at the transfer destination.


Test result 2.3

$ mqpgf -qm RemoteQM -q RemoteQ -br
message number: 1
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[273] CodedCharSetId[1208] Format[MQSTR ] Priority[0] Persistence[0] MsgId[0x414D512053616D706C65514D20202020CA52965A258FD602] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x16010515000000DBEB0C50B47B733407E53B2B8433260000000000000000000B] ApplIdentityData[ ] PutApplType[11] PutApplName[\cprog\win\mqpgf14\mqpgf.exe] PutDate[20180228] PutTime[07122197] ApplOriginData[ ]

GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]

data length: 9
00000000: EFBC A1EF BCA2 EFBC A3 '......... '

Make sure that the MQMD Encoding, CodedCharSetId values, and data are converted. The sample test is as follows.

Encoding: 273(NORMAL)
CodedCharSetId: 1208(UTF-8)
data: 0xEFBCA1 EFBCA2 EFBCA3 (UTF-8 full width "ABC")

fig 2.3

When testing is complete, set the channel CONVERT property back to NO and restart the channel.

alter chl('SampleQMW.RemoteQM') chltype(sdr) convert(no)
2 : alter chl('SampleQMW.RemoteQM') chltype(sdr) convert(no)
AMQ8016: IBM MQ channel has changed.

If necessary, restore the queue manager CCSID.


Ex. 2.4 Data conversion of messages with MQRFH2 at the time of MQGET

Next, try data conversion by specifying MQGMO_CONVERT at MQGET(). This example converts data of RFH2 header and user data simultaneously. In previus test, it was not confirmed the conversion of the encoding, but this test will also convert the encoding of the RFH2 header. This test does not depend on the queue manager's CCSID or system encoding because both source and destination Encoding, CodedCharSetId are specified.

PUT the message by specifying the following.

MQMD.Encoding: 273(Big Endian)
MQMD.CharSetId: 943(SHIFT_JIS:New JIS)
MQRFH2.CodedCharSetId: 5050(eucJP)
MQRFH2.NameValueData: Optional half-width alphanumeric characters Ascii equivalent
data: 0x8eb1 8eb2 8eb3 A string in hexadecimal notation equivalent to the half size characters "アイウ" of eucJP

*MQMD.Encoding and MQMD.CharSetId indicate encoding and character code of RFH2, not MQMD.
*MQRFH2.CodedCharSetId represents the character code of user data following NameValuData, not RFH2 itself or MQRFH2.NameValueData.

Although it is a little long, PUT the message with the following argument.

$ mqpgf -qm SampleQM -q SampleQ -ec 273 -cc 943 -mx 8eb18eb28eb3 -rf MQFMT_STRING -nd "test1,test2ru2,test333" MQFMT_RF_HEADER_2 -rc 5050
[18/02/28 19:57:35] 1: message length: 6 put message : 0x8EB18EB28EB3

*Option descriptions
-ec: MQMD.Encoding
-cc: MQMD.CodedCharSetId
-rf: MQRFH2.Format
-nd: MQRFH2.NameValueData
-rc: MQRFH2.CodedCharSetId
MQFMT_RF_HEADER_2: Add MQRFH2

Check the contents of the PUT message without converting data. Try dumping with both "-brv" and "-br" for easy comparison later.

$ mqpgf -qm SampleQM -q SampleQ -brv
message number: 1
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[273] CodedCharSetId[943] Format[MQHRF2 ] Priority[0] Persistence[0] MsgId[0x414D512053616D706C65514D202020205A9637CC2000290B] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x0534343033310000000000000000000000000000000000000000000000000006] ApplIdentityData[ ] PutApplType[13] PutApplName[mqpgf ] PutDate[20180228] PutTime[10573561] ApplOriginData[ ]

GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]

*StrucId[RFH ] Version[2] StrucLength[72] Encoding[273] CodedCharSetId[5050] Format[MQSTR ] Flags[0] NameValueCCSID[1208]
NameValueLength[8] NameValueData[test1 ]
NameValueLength[8] NameValueData[test22 ]
NameValueLength[8] NameValueData[test333 ]
data length: 78
00000000: 8EB1 8EB2 8EB3 '...... '

$ mqpgf -qm SampleQM -q SampleQ -br
message number: 1
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[273] CodedCharSetId[943] Format[MQHRF2 ] Priority[0] Persistence[0] MsgId[0x414D512053616D706C65514D202020205A9637CC2000290B] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x0534343033310000000000000000000000000000000000000000000000000006] ApplIdentityData[ ] PutApplType[13] PutApplName[mqpgf ] PutDate[20180228] PutTime[10573561] ApplOriginData[ ]

GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]

data length: 78
00000000: 5246 4820 0000 0002 0000 0048 0000 0111 'RFH .......H....'
00000010: 0000 13BA 4D51 5354 5220 2020 0000 0000 '....MQSTR ....'
00000020: 0000 04B8 0000 0008 7465 7374 3120 2020 '........test1 '
00000030: 0000 0008 7465 7374 3232 2020 0000 0008 '....test22 ....'
00000040: 7465 7374 3333 3320 8EB1 8EB2 8EB3 'test333 ......

Try to execute code conversion by specifying MQMD.Encoding = 546 (Little Endian) and MQMD.CharSetId = 930 (EBCDIC) at MQGET().


Test result 2.4

$ mqpgf -qm SampleQM -q SampleQ -br MQGMO_CONVERT -ec 546 -cc 930
message number: 1
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[546] CodedCharSetId[930] Format[MQHRF2 ] Priority[0] Persistence[0] MsgId[0x414D512053616D706C65514D202020205A9637CC2000290B] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x0534343033310000000000000000000000000000000000000000000000000006] ApplIdentityData[ ] PutApplType[13] PutApplName[mqpgf ] PutDate[20180228] PutTime[10573561] ApplOriginData[ ]

GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]

data length: 75
00000000: D9C6 C840 0200 0000 4800 0000 2202 0000 '...@....H..."...'
00000010: A203 0000 D4D8 E2E3 D940 4040 0000 0000 '.........@@@....'
00000020: B804 0000 0800 0000 7465 7374 3120 2020 '........test1 '
00000030: 0800 0000 7465 7374 3232 2020 0800 0000 '....test22 ....'
00000040: 7465 7374 3333 3320 8182 83 'test333 ... '

*Option descriptions
MQGMO_CONVERT: Set to MQGMO.Options

Try to examine the converted content in detail.

00000000-00000003 : D9C6 C840 (StrucIdの"RFH ")
The character code of MQRFH2 itself is converted from SHIFTJIS (CCSID 943) to EBCDIC (CCSID 930).

00000004-00000007 : 0200 0000 (MQRFH_VERSION_2(2) For Big Endian: 0000 0002)
The encoding of MQRFH2 itself has been converted to Little Endian.

0000000C-0000000F : 2202 0000 (MQRFH2.Encoding(546) For Big Endian: 0000 0222)
MQRFH2.Encoding is set to 546 (Little Endian).

00000010-00000011 : A203 0000 (MQRFH2.CodedCharSetId (930) For Big Endian 0000 03A2)
MQRFH2.CodedCharSetId is set to EBCDIC (CCSID 930).

00000020-00000023 : B804 0000 (MQRFH2.NameValueCCSID(1208) For Big Endian 0000 04 B8
MQRFH2.NameValueCCSID remains UTF-8 (CCSID 1208) (NameValueData is fixed to UTF-8 and is not subject to data conversion).

00000048-0000004a : 8182 83 (Japanese EBCDIC half size characters "アイウ")
User data has been converted from eucJP to Japanese EBCDIC. (The character notation on the right side of the hexadecimal dump indicates the visible characters of the locale of the environment where the program (mqpgf) was executed. Note that it is not displayed the character notation in EBCDIC specified as the character code of the conversion destination this time.)

fig 2.4

[ Priority ]

Type: MQLONG
Size: 4 bytes
Initial value: MQPRI_PRIORITY_AS_Q_DEF (-1)
Input / output: MQGET (): Output, MQPUT (): Input

When you put a message on a queue, you can set the priority of the message (in the Priority field of the MQMD structure). When MQPRI_PRIORITY_AS_Q_DEF (default) is specified, the value (default '0') set in the queue DEFPRTY is set. The priority is 0-9 and the highest priority is "9", which is defined by the queue manager MAXPRTY. This property is fixed and can not be changed. In the MSGDLVSQ property of the queue, it is also possible to specify in the queue properties whether to store FIFO (first in first out) on the queue or to follow the priority (messages of the same priority are in FIFO order).


Ex. 2.5 Priority at the time of GET

Now, try to check the behavior when MSGDLVSQ values for the queue are set to PRIORITY and FIFO respectively.
Check MSGDLVSQ.The default value of MSGDLVSQ is PRIORITY.

$ mqpcf que -qm SampleQM -q SampleQ MSGDLVSQ
1: QUEUE(SampleQ) TYPE(QLOCAL) MSGDLVSQ(PRIORITY)

*Option descriptions
MSGDLVSQ: Display MSGDLVSQ field

PUT messages with different priorities at random.


$ mqpgf -qm SampleQM -q SampleQ -m "priority 3" -pr 3
[18/03/07 18:53:52] 1: message length: 10 put message : priority 3
$ mqpgf -qm SampleQM -q SampleQ -m "priority default"
[18/03/07 18:54:10] 1: message length: 16 put message : priority default
$ mqpgf -qm SampleQM -q SampleQ -m "priority 8" -pr 8
[18/03/07 18:54:16] 1: message length: 10 put message : priority 8

*Option descriptions
-pr: Specify MQMD.Priority

Make sure that messages get GET in order of priority.


Test result 2.5.1

$ mqpgf -qm SampleQM -q SampleQ -br -r
message number: 1
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[273] CodedCharSetId[943] Format[ ] Priority[8] Persistence[0] MsgId[0x414D512053616D706C65514D202020205A9FB6A820001A06] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x0534343033310000000000000000000000000000000000000000000000000006] ApplIdentityData[ ] PutApplType[13] PutApplName[mqpgf ] PutDate[20180307] PutTime[09541668] ApplOriginData[ ]

GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]

data length: 10
00000000: 7072 696F 7269 7479 2038 'priority 8 '

message number: 2
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[273] CodedCharSetId[943] Format[ ] Priority[3] Persistence[0] MsgId[0x414D512053616D706C65514D202020205A9FB6A820001A02] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x0534343033310000000000000000000000000000000000000000000000000006] ApplIdentityData[ ] PutApplType[13] PutApplName[mqpgf ] PutDate[20180307] PutTime[09535298] ApplOriginData[ ]

GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]

data length: 10
00000000: 7072 696F 7269 7479 2033 'priority 3 '

message number: 3
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[273] CodedCharSetId[943] Format[ ] Priority[0] Persistence[0] MsgId[0x414D512053616D706C65514D202020205A9FB6A820001A04] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x0534343033310000000000000000000000000000000000000000000000000006] ApplIdentityData[ ] PutApplType[13] PutApplName[mqpgf ] PutDate[20180307] PutTime[09541028] ApplOriginData[ ]

GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]

data length: 16
00000000: 7072 696F 7269 7479 2064 6566 6175 6C74 'priority default'

fig 2.5

Once you clear the queue.

$ mqpcf clr -qm SampleQM -q SampleQ
Clear Queue Success. Queue Name : SampleQ

Change the queue distribution sequence to FIFO (first in, first out) in the MSGDLVSQ property.

MQSC > alter ql('SampleQ') msgdlvsq(fifo)
1 : alter ql('SampleQ') msgdlvsq(fifo)
AMQ8008: IBM MQ queue changed.

PUT same messages as before that have different priority and check the order to be GET.


Test result 2.5.2

$ mqpgf -qm SampleQM -q SampleQ -br -r
message number: 1
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[273] CodedCharSetId[943] Format[ ] Priority[3] Persistence[0] MsgId[0x414D512053616D706C65514D202020205A9FB6A820002505] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x0534343033310000000000000000000000000000000000000000000000000006] ApplIdentityData[ ] PutApplType[13] PutApplName[mqpgf ] PutDate[20180307] PutTime[10042898] ApplOriginData[ ]

GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]

data length: 10
00000000: 7072 696F 7269 7479 2033 'priority 3 '

message number: 2
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[273] CodedCharSetId[943] Format[ ] Priority[0] Persistence[0] MsgId[0x414D512053616D706C65514D202020205A9FB6A820002507] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x0534343033310000000000000000000000000000000000000000000000000006] ApplIdentityData[ ] PutApplType[13] PutApplName[mqpgf ] PutDate[20180307] PutTime[10043442] ApplOriginData[ ]

GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]

data length: 16
00000000: 7072 696F 7269 7479 2064 6566 6175 6C74 'priority default'

message number: 3
*StrucId[MD ] Version[2] Report[0] MsgType[8] Expiry[-1] Feedback[0] Encoding[273] CodedCharSetId[943] Format[ ] Priority[8] Persistence[0] MsgId[0x414D512053616D706C65514D202020205A9FB6A820002509] CorrelId[0x000000000000000000000000000000000000000000000000] BackoutCount[0] ReplyToQ[ ] ReplyToQMgr[SampleQM ] UserIdentifier[mqm ] AccountingToken[0x0534343033310000000000000000000000000000000000000000000000000006] ApplIdentityData[ ] PutApplType[13] PutApplName[mqpgf ] PutDate[20180307] PutTime[10043964] ApplOriginData[ ]

GroupId[0x000000000000000000000000000000000000000000000000] MsgSeqNumber[1] Offset[0] MsgFlags[0] OriginalLength[-1]

data length: 10
00000000: 7072 696F 7269 7479 2038 'priority 8 '

Regardless of the priority of the messages, you can confirm that you can GET messages in the order of PUT.

fig 2.6

After testing, set MSGDLVSQ back to default.

[ Persistence ]

Type: MQLONG
Size: 4 bytes
Initial value: MQPER_PERSISTENCE_AS_Q_DEF (2)
I / O: MQGET(): Output, MQPUT(): Input

Indicates the persistence of the message. There are the following types.

MQPER_NOT_PERSISTENT 0 Non persistent message.
MQPER_PERSISTENT 1 Persistent message.
MQPER_PERSISTENCE_AS_Q_DEF 2 Set according to the queue's DEFPSIST property.

Non-persistent messages do not exist after system failure and queue manager restarts. However, if you set the queue's NPMCLASS property to 'HIGH', it will persist after a normal restart of the queue manager. Persistent messages persist across system failures and queue manager restarts. However, because messages are written to transaction-managed log files, performance is slower than when using non-persistent messages. By default, MQPER_PERSISTENT or MQPER_NOT_PERSISTENT will be set on the message according to the queue's DEFPSIST property when the message is written.

When specifying from mqpgf, specify one of the above constants directly as an argument. Only the command example is shown.

$ mqpcf que -qm SampleQM -q SampleQ DEFPSIST NPMCLASS
1: QUEUE(SampleQ) TYPE(QLOCAL) DEFPSIST(NO) NPMCLASS(NORMAL)

*Option Description
DEFPSIST: Display of DEFPSIST (default persistence) field
NPMCLASS: Display of NPMCLASS (non-persistent message rate) field


$ mqpgf -qm SampleQM -q SampleQ -m "non-persistent" MQPER_NOT_PERSISTENT
$ mqpgf -qm SampleQM -q SampleQ -m "persistent" MQPER_PERSISTENT

*Option Description
MQPER_PERSISTENT: Set '1' to MQMD.Persistence.
MQPER_NOT_PERSISTENT: Set '0' to MQMD.Persistence.

to the top

to the top