| Author | 
		  Message
		 | 
		
		  | paribok | 
		  
		    
			  
				 Posted: Mon Aug 05, 2013 9:22 pm    Post subject: Setting Message Properties on msg published to a topic | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 05 Aug 2013 Posts: 13
  
  | 
		  
		    
			  
				Hi,
 
I'm trying to make the selectors on subscriptions work (using zOS MQ 7.1, COBOL). Hoping someone can shed some light.  So this is what I'm doing. I'm setting a property name called 'ZIP' with a value of '9999'.  I'm doing this because I want to set some subscriptions to get publications only if ZIP is = '9999'.
 
 
1. MQOPEN on topic
 
2. MQCRTMH to get message handle
 
3. MQSETMP - using the handle from #2
 
4. MQPUT to topic
 
 
code for MQSETMP :
 
 
SET MQCHARV-VSPPT TO ADDRESS OF MP-PROP-NAME ** where MP-PROP-NAME is the property name
 
MOVE LENGTH OF MP-PROP-NAME  TO MQCHARV-VSLENGTH
 
MOVE '9999' TO MP-VALUE
 
MOVE LENGTH OF MP-VALUE TO MP-VALUELENGTH
 
MOVE MQPD-USER-CONTEXT TO MQPD-CONTEXT
 
MOVE MQTYPE-BYTE-STRING TO MP-TYPE
 
 
CALL MQSETMP USING QMGR-HANDLE
 
                                  MSG-HANDLE  ** FROM MQCRTMH CALL
 
                                  SETMSGOPTS  ** CMQSMPOV
 
                                   NAME   *** CMQCHRVV
 
                                   PROPDESC
 
                                   MP-TYPE
 
                                   MP-VALUELENGTH
 
                                   MP-VALUE
 
                                   COMPCODE
 
                                   REASON
 
 
 
the call gives compcode of zeroes.
 
 
There are 2 subscriptions to the topic (ie 2 different queue destinations)  The only difference between the 2 is that subscriber queue#2 has selector of 'usr.ZIP=''9999''' on it (im expecting it to be in the usr folder as I had set the context to user context).  
 
 
subscriber queue#1 is getting the publication. subscriber queue #2 is not.  
 
 
I tried both "Compatibility" and "Message Properties" Properties for the subscription.
 
 
When I browse the publication (via mqexplorer) that got delivered to queue #1, I can't see the message property ZIP that I had set when publishing.  
 
 
Would appreciate any feedback ?
 
 
Thanks !! | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Tue Aug 06, 2013 6:41 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				| "usr.ZIP" is an MQRFH2 folder path, not a message property path, as far as I understand it. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | hughson | 
		  
		    
			  
				 Posted: Wed Aug 07, 2013 2:32 am    Post subject: Re: Setting Message Properties on msg published to a topic | 
				     | 
			   
			 
		   | 
		
		
		    Padawan
 
 Joined: 09 May 2013 Posts: 1967 Location: Bay of Plenty, New Zealand 
  | 
		  
		    
			  
				
   
	| paribok wrote: | 
   
  
	I'm setting a property name called 'ZIP' with a value of '9999'. 
 
 
subscriber queue#2 has selector of 'usr.ZIP=''9999''' on it (im expecting it to be in the usr folder as I had set the context to user context). | 
   
 
 
 
If you set the property as ZIP, why not subscribe for it as ZIP?
 
 
If you think your property may have ended up somewhere else, you could always browse a copy of the message that was delivered to see where your property went. The MQ Explorer will show you properties, or various other samples and tools will too.
 
 
Cheers
 
Morag _________________ Morag Hughson @MoragHughson
 
IBM MQ Technical Education Specialist
 
Get your IBM MQ training here!
 
MQGem Software | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | hughson | 
		  
		    
			  
				 Posted: Wed Aug 07, 2013 2:39 am    Post subject: Re: Setting Message Properties on msg published to a topic | 
				     | 
			   
			 
		   | 
		
		
		    Padawan
 
 Joined: 09 May 2013 Posts: 1967 Location: Bay of Plenty, New Zealand 
  | 
		  
		    
			  
				
   
	| paribok wrote: | 
   
  
	(im expecting it to be in the usr folder as I had set the context to user context)
 
 
MOVE MQPD-USER-CONTEXT TO MQPD-CONTEXT | 
   
 
 
 
Have just worked out what you were referring to by the statement in brackets.
 
 
MQPD-USER-CONTEXT has no bearing on the folder that the property goes in. It indicates that the property you have set would be passed by an application using MQOO_SAVE_ALL_CONTEXT and then MQPMO_PASS_ALL_CONTEXT - a technique used by routing applications to pass over various fields in the MQMD from the original message.
 
 
You can read more about context in Message context.
 
 
This setting is not doing what you think it is doing. Try subscribing for just ZIP rather than usr.ZIP.
 
 
Cheers
 
Morag _________________ Morag Hughson @MoragHughson
 
IBM MQ Technical Education Specialist
 
Get your IBM MQ training here!
 
MQGem Software | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | paribok | 
		  
		    
			  
				 Posted: Wed Aug 07, 2013 4:01 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 05 Aug 2013 Posts: 13
  
  | 
		  
		    
			  
				Thanks Morag!  (btw I attended your sessions at this year's Impact   you were great! thanks so much for all those info!!)
 
 
So I did find the problem (not without help) 
 
 
It was a combination of things.  First, I wasn't getting the entire value of my message handle (duh) - I had defined the message handle as s9(9) binary by mistake (copy/paste) so I wasn't getting the full handle value.  Once I changed that, then I was getting the correct handle. When I used it though in MQPMO-ORIGINALMSGHANDLE, MQPUT was complaining (2046) about my MQPMO OPTIONS. Then learned later that it shouldnt be included in the MQPMO OPTIONS computation. So now, with the message handle for the property, and the MQPMO VERSION set to 3, and MQPMO-ACTION set to MQACTP-NEW, my MQPUT works and I see the property in the delivered message via MQExplorer. 
 
 
But now ... so subscriber #1 gets a publication because it just subscribes to the topic, no selectors.  Subscriber #2 subscribes to the same topic, but has the selector of ZIP = '94101' (so i'd like it to get the publication only if property ZIP is = 94101) , and it's still not getting it's message.
 
 
Browsed message property in MQExplorer, I see the Name as ZIP but Value has [B@64386438 , instead of '94101' .    | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | paribok | 
		  
		    
			  
				 Posted: Wed Aug 07, 2013 4:21 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 05 Aug 2013 Posts: 13
  
  | 
		  
		    
			  
				| I am putting a value of '94101' when I call MQSETMP. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bruce2359 | 
		  
		    
			  
				 Posted: Wed Aug 07, 2013 5:51 pm    Post subject: Re: Setting Message Properties on msg published to a topic | 
				     | 
			   
			 
		   | 
		
		
		    Poobah
 
 Joined: 05 Jan 2008 Posts: 9486 Location: US: west coast, almost. Otherwise, enroute. 
  | 
		  
		    
			  
				
   
	| paribok wrote: | 
   
  
	
 
MOVE '9999' TO MP-VALUE
 
MOVE LENGTH OF MP-VALUE TO MP-VALUELENGTH
 
...
 
I am putting a value of '94101' when I call MQSETMP.
 
...
 
 | 
   
 
 
What kind of field is MP-VALUE?  What is its PIC? _________________ I like deadlines. I like to wave as they pass by.
 
ב''ה
 
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | paribok | 
		  
		    
			  
				 Posted: Wed Aug 07, 2013 8:55 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 05 Aug 2013 Posts: 13
  
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Thu Aug 08, 2013 6:35 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				| Is MQTYPE-BYTE-STRING the right thing to set for PIC x(5)? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | paribok | 
		  
		    
			  
				 Posted: Thu Aug 08, 2013 7:34 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 05 Aug 2013 Posts: 13
  
  | 
		  
		    
			  
				Yay that was it Jeff !! I didn't realize there is MQTYPE-STRING. I used that instead and it works now !!!    
 
 
You guys are awwweeeesome!! | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |