For MQ on z/OS you have been able to use the EXTRACT capability of CSQ1LOGP to process the log data sets and get the messages back out - useful if you want to know who put or got a message.
See here for more information
I was asked to show how to extract data from the logs to make it usable. Below I have used the ICETOOL capability of the IBM DFSORT program to extract and display the data from the logs.
This only works for persistent message as non persistent messages are not logged.
The output is
TIME URID USERID APPTYPE JOBNAME QMGR LEN QUEUE VERB MSG_KEY SEG DATA
------------ ---------------- -------- -------- -------- ---- ----------- ---------------- ------ ---------------- ----------- ----
18:25:28.800 024EA8FA48040000 PAICE BATCH PAICEH1 MQPA +32296 CP0001 MQPUT 000000010019F932 +1 MD
18:25:28.800 024EA8FA48040000 PAICE BATCH PAICEH1 MQPA +32385 CP0001 MQPUT 000000010019F932 +2 xxxx
18:25:28.800 024EA8FA48040000 PAICE BATCH PAICEH1 MQPA +32385 CP0001 MQPUT 000000010019F932 +3 xxxx
18:25:28.800 024EA8FA48040000 PAICE BATCH PAICEH1 MQPA +32385 CP0001 MQPUT 000000010019F932 +4 xxxx
18:25:28.800 024EA8FA48040000 PAICE BATCH PAICEH1 MQPA +32385 CP0001 MQPUT 000000010019F932 +5 xxxx
Long messages are segmented. The above data shows there are 5 segments for the message. The message content is all xxxx's. The first 4 bytes of the data are displayed under the DATA column. The first segment has the MD, the remaining segments have xxxx from the message body.
Len is the length of the user data.
Each message has a message key. After the message been got there will be a message with VERB = MQGET and the same key.
The JCL below extracts the records for MQPUT requests. This covers MQPUT and MQPUT1
The column number used by ICETOOL is from the start of the record. DFSORT processes the record as an undefined format record, and so the 4 bytes of information about the size of the record(Record Descriptor Word) are available. This means you have to add 4 bytes to the offsets of the data within the record to get the offset for ICETOOL
//TOOLRUN EXEC PGM=ICETOOL,REGION=0M
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN) TO(TEMP1) USING(CTL1)
* This reads from the //IN DD statement and outputs it to //TEMP1 DD statements
* The commands for DFSORT are in the //CTL1CNTL DD statement
DISPLAY FROM(TEMP1) LIST(OUT1) PLUS -
* This reads the output from Sort on //TEMP1 and displays it on //OUT1 DD statement
* Plus makes the column widths smaller.
* one blank between columns
* so you get lots of data before the columns are displayed
* so you have with output ( this is the maximum length)
HEADER('TIME') ON(14,12,CH) -
* This display a column called TIME and formats it as a CHaracter string
HEADER('URID') ON(41,8,HEX) -
* This displays the Unit of Recovery ID in hex
HEADER('USERID') ON(59,8,CH) -
* This displays the userid that put the message
HEADER('APPTYPE') ON(83,8,CH) -
* This displays the type of application such as BATCH
HEADER('JOBNAME') ON(91,8,CH) -
* This displays the name of the job that put the message
HEADER('QMGR') ON(106,4,CH) -
* This is the queue manager name
HEADER('LEN') ON(102,4,BI) -
*This is the lenth of the data
HEADER('QUEUE') ON(110,16,CH) -
* Which queue was used.
HEADER('VERB') ON(178,6,CH) -
* This is the MQ Activity, MQPUT, MQGET COMMIT, ABORT, EXPIRE etc
*HEADER('SL') ON(200,1,HEX) -
* This can be used to display if it was LOCAL(01) or Shared(02)
HEADER('MSG_KEY') ON(170,8,HEX) -
* This is the message key for local queues
HEADER('SEG ') ON(201,4,BI) -
* This is the segment number
* The first 4 bytes of the message
* You can display the data in CH and then use ISPF editor command HEX ON to view the data
* which are not printable
//CTL1CNTL DD *
* SELECT THE RECORDS WHICH WERE PUT
//IN DD DISP=SHR,DSN=PAICE.EXTRACT.MQPB
//TEMP1 DD DISP=(NEW,DELETE),DSN=&TEMP1,SPACE=(CYL,(10,10))
//OUT1 DD SYSOUT=*
To process the file for MQGET, you have to copy the JCL and remove the SEG and DATA fields as the records for MQGET do not have these fields and so the records are shorter. DFSORT stops if it detects a record which it is too small. Then change the 'MQPUT' to 'MQGET'