|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Determining MQRO msg id/correl id |
« View previous topic :: View next topic » |
Author |
Message
|
derickk |
Posted: Thu Feb 20, 2003 10:01 am Post subject: Determining MQRO msg id/correl id |
|
|
Newbie
Joined: 20 Feb 2003 Posts: 3
|
Hi,
I'm coding a server program in COBOL II. I was wondering if anyone has an algorithm for determining whether a request message has set the MQRO-PASS-MSG-ID and/or MQRO-PASS-CORREL-ID options.
Thanks,
Derick |
|
Back to top |
|
 |
PeterPotkay |
Posted: Sat Feb 22, 2003 10:02 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
The following code is from my COBOL MQSeries Wrapper program. The true values it is setting for N000MQ-* are values in a copybook that is passed back to the calling module, telling the calling module which if any of the REPORT options were set for this particular messsage that is being returned.
Note that W25-2 is defined as follows
Code: |
WORKING-STORAGE
.
.
042800 01 W25-LITERALS.
.
.
043100 05 W25-2 PIC 9(1) VALUE 2.
|
Code: |
249900 P0600-COMPUTE-REPORT-REPLY-RC.
250000*****************************************************************
250100*** FUNCTION: ***
250200*** ***
250300*** PERFORMED BY: ***
250400*** ***
250500*** PERFORMS: NO OTHER ***
250600*** ***
250700*** NOTES: ***
250800*** WHEN GETTING A MESSAGE THAT IS A REQUEST, WE NEED ***
250900*** TO SEE IF THE REQUESTOR SET ANY OF THE REPORT ***
251000*** OPTIONS THAT REQUIRE US TO DO SOMETHING. WE WILL ***
251100*** ONLY CHECK FOR 4 OF THESE REPORT REQUESTS, PAN, NAN,***
251200*** HOW TO HANDLE MSGID, HOW TO HANDLE CORRELID. (ALL ***
251300*** OTHER REPORTS ARE HANDLED BY THE QUEUE MANAGER) ***
251400*** ***
251500*** IF THE MQMD-REPORT FIELD IS ZERO, THEN WE SKIP ALL ***
251600*** THE INDIVIDUAL CHECKS FOR THE DIFFERENT REPORT ***
251700*** OPTIONS, AND INSTEAD SET THE DEFAULTS TO TRUE. ***
251800*** ***
251900*** ***
252000*****************************************************************
252100
252200 IF MQMD-REPORT = ZERO
252300 SET N000MQ-GENERATE-NEW-MSGID TO TRUE
252400 SET N000MQ-PASS-MSGID-TO-CORRELID TO TRUE
252500 ELSE
252600 PERFORM P0610-CHECK-FOR-PAN-REPORT
252700
252800 PERFORM P0620-CHECK-FOR-NAN-REPORT
252900
253000 PERFORM P0630-CHECK-FOR-MSGID-OPTIONS
253100
253200 PERFORM P0640-CHECK-FOR-CRRLID-OPTIONS
253300 END-IF
253400 .
253500
253600
253700
253800 P0610-CHECK-FOR-PAN-REPORT.
253900*****************************************************************
254000*** FUNCTION: DETERMINES WHETHER A PAN REPORT HAS BEEN ***
254100*** REQUESTED ***
254200*** ***
254300*** PERFORMED BY: P0600-REPORT-REPLY-RC ***
254400*** ***
254500*** PERFORMS: NO OTHER ***
254600*** ***
254700*** NOTES: ***
254800*****************************************************************
254900
255000 IF ((MQMD-REPORT / MQRO-PAN) / W25-2 * W25-2)
255100 = (MQMD-REPORT / MQRO-PAN)
255200 CONTINUE
255300 ELSE
255400 SET N000MQ-PAN-REPORT-REQUESTED TO TRUE
255500 END-IF
255600 .
255700
255800
255900 P0620-CHECK-FOR-NAN-REPORT.
256000*****************************************************************
256100*** FUNCTION: DETERMINES WHETHER A NAN REPORT HAS BEEN ***
256200*** REQUESTED ***
256300*** ***
256400*** PERFORMED BY: P0600-REPORT-REPLY-RC ***
256500*** ***
256600*** PERFORMS: NO OTHER ***
256700*** ***
256800*** NOTES: ***
256900*****************************************************************
257000
257100 IF ((MQMD-REPORT / MQRO-NAN) / W25-2 * W25-2)
257200 = (MQMD-REPORT / MQRO-NAN)
257300 CONTINUE
257400 ELSE
257500 SET N000MQ-NAN-REPORT-REQUESTED TO TRUE
257600 END-IF
257700 .
257800
257900
258000 P0630-CHECK-FOR-MSGID-OPTIONS.
258100*****************************************************************
258200*** FUNCTION: DETERMINES HOW THE MSGID OF THE REQUEST MESSAGE ***
258300*** SHOULD BE HANDLED WHEN BUILDING THE REPLY ***
258400*** ***
258500*** PERFORMED BY: P0600-REPORT-REPLY-RC ***
258600*** ***
258700*** PERFORMS: NO OTHER ***
258800*** ***
258900*** NOTES: ***
259000*****************************************************************
259100
259200 IF ((MQMD-REPORT / MQRO-PASS-MSG-ID) / W25-2 * W25-2)
259300 = (MQMD-REPORT / MQRO-PASS-MSG-ID)
259400 SET N000MQ-GENERATE-NEW-MSGID TO TRUE
259500 ELSE
259600 SET N000MQ-PASS-MSGID-TO-MSGID TO TRUE
259700 END-IF
259800 .
259900
260000
260100 P0640-CHECK-FOR-CRRLID-OPTIONS.
260200*****************************************************************
260300*** FUNCTION: DETERMINES WHETHER WE NEED TO PASS THE CORRELID ***
260400*** FROM THE REQUEST TO THE CORRELID OF THE REPLY ***
260500*** ***
260600*** PERFORMED BY: P0600-REPORT-REPLY-RC ***
260700*** ***
260800*** PERFORMS: NO OTHER ***
260900*** ***
261000*** NOTES: ***
261100*****************************************************************
261200
261300 IF ((MQMD-REPORT / MQRO-PASS-CORREL-ID) / W25-2 * W25-2)
261400 = (MQMD-REPORT / MQRO-PASS-CORREL-ID)
261500 SET N000MQ-PASS-MSGID-TO-CORRELID TO TRUE
261600 ELSE
261700 SET N000MQ-PASS-CORREL-TO-CORREL TO TRUE
261800 END-IF
261900 .
|
_________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
derickk |
Posted: Mon Feb 24, 2003 6:45 am Post subject: |
|
|
Newbie
Joined: 20 Feb 2003 Posts: 3
|
Thanks for the reply, PeterPotKay. I have a question, though. Just looking at the equations, it appears that the conditions will always evaluate as TRUE.
For instance, if we look at the first conditional statement:
IF ((MQMD-REPORT / MQRO-PAN) / W25-2 * W25-2)
= (MQMD-REPORT / MQRO-PAN)
If we substitute X for (MQMD-REPORT / MQRO-PAN) and the WS value of 2 for W25-2, then we get:
IF (X / 2 * 2) = X, which resolves to IF X = X
Am I not seeing something, or taking something else into consideration?
Thanks,
Derick |
|
Back to top |
|
 |
PeterPotkay |
Posted: Mon Feb 24, 2003 8:11 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
I got stuck on this too. I couldn't understand why it worked!
The answer is that it relies on the truncation of fractions. Take Pass Correl ID as an example. It's value is 64. Assume it is the only Report Option set.
((64 / 64) / 2 * 2) = 64 / 64
(1 / 2) * 2 = 1
0.5 * 2 = 1
(now truncate the fraction)
0 * 2 = 1 is false, so the formula causes the ELSE to kick in, which says the Option has been set.
This formula only works when fractions are truncated, i.e. it worked for my COBOL programs but not VB.
It also only works for only single bit constants, which the four that I chose to check for are. It will not for for something like MQRO-EXCEPTION. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
derickk |
Posted: Mon Feb 24, 2003 8:41 am Post subject: |
|
|
Newbie
Joined: 20 Feb 2003 Posts: 3
|
ahhhh!
Thanks, again.
Derick |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|