Page 1 of 1

Doubt in MQSETMP

PostPosted: Tue Apr 25, 2017 12:53 am
by chandru3183
Hi All,

I have a requirement to create new user defined header like the below using the COBOL program.
My Message property: Sample1  

Manual suggest me to use "MQSETMP' call statement and MQCRTMH call statement should be coded prior to that.
Can anyone provide me the copybook declaration details for these two call statements?

Thanks and regards,
Newbee

Re: Doubt in MQSETMP

PostPosted: Tue Apr 25, 2017 2:21 am
by Robert Sample
Have you looked at these calls in the manual https://www.ibm.com/support/knowledgece ... 01910_.htm ? If you have, then what more do you need to code them up? If you have not, then start there and come back to us if you have questions after reading and digesting the manual statements.

Re: Doubt in MQSETMP

PostPosted: Tue Apr 25, 2017 8:23 am
by chandru3183
I am not able to see the content of the copybook CMQCHRVV and CMQSMPOV. I have also searched in google but did not get the luck.
Could you please help me on this

Re: Doubt in MQSETMP

PostPosted: Tue Apr 25, 2017 4:42 pm
by NicC
Why do you need to see them? If you needed to see them then they would have been shown. The document is very clear about what fields you need to be aware of. If they are not mentioned then they do not need to be worried about.

If you really want to see them, wait until your program is compiled.

Re: Doubt in MQSETMP

PostPosted: Tue Apr 25, 2017 5:07 pm
by Robert Sample
If you insist you "need" to see those copy books (and you don't need to see them, you want to see them), contact your site support group. The specific libraries used will vary from site to site, so only someone working AT YOUR SITE can possibly help you.

Re: Doubt in MQSETMP

PostPosted: Wed Apr 26, 2017 11:21 pm
by chandru3183
Thank you. i understand the copybook is predefined and it will automatically expanded when we compile the program.
I am doing myself in constructing the new property and put the message to the target queue. I am getting reason code 2442.
This may be due to the MQSETMP-PROPDESC and MQSETMP-NAME. I will try to add the values for two fields and test the program.
Could you please share any samples to refer the COBOL program to put the message with user defined message property?
If not, Can you please guide me in the right direction?

CALL 'MQCRTMH' USING HCONN
             MQCRTMH-CRTMSGHOPTS
             HMSG
             MQ-COMPCODE
             MQ-REASON

SET MQCHARV-VSPTR   TO ADDRESS OF MQSETMP-NAME
MOVE LENGTH OF MQSETMP-NAME  TO MQCHARV-VSLENGTH
MOVE 'Type1'         TO MQSETMP-VALUE

CALL 'MQSETMP' USING HCONN
            HMSG
            MQSETMP-SETMSGOPTS
            MQSETMP-NAME
            MQSETMP-PROPDESC
            MQSETMP-TYPE
            MQSETMP-TYPELENGTH
            MQSETMP-VALUE
            MQ-COMPCODE
            MQ-REASON   ---> 2442 is the reason code
 

Re: Doubt in MQSETMP

PostPosted: Thu Apr 27, 2017 12:16 am
by Robert Sample
You did not include your MQCONN or MQCONNX call, which is required before using MQCRTMH. Did you not code one, or did you merely not post what could be vital information?

And there are COBOL examples here: https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.ref.dev.doc/q089750_.htm . I also found
The name of a message property is its full path name, with the XML-like, <> syntax, replaced by dots. For example, myPropertyFolder1.myGroup1.myGroup2.myProperty1 is mapped to a NameValueData string in Figure 17. The string is formatted for easier reading.
<myPropertyFolder1>
    <myGroup1>
        <myGroup2>
            <myProperty1>
            value
            </myProperty1>
        </myGroup2>
    </myGroup1>
</myPropertyFolder1>

Figure 17. Single property name mapping


You are not posting a whole lot of information to help you -- for example, you didn't bother to post the variable definitions or values for the various variables in your CALL statements.

Re: Doubt in MQSETMP

PostPosted: Thu Apr 27, 2017 9:40 pm
by chandru3183
PFB the updated code for the MQ program.
MQCRTMH --> Call and reason code is successful
MQSETMP --> Getting reason code 2442
MQPUT --> Call and reason code is successful


** Declaration part looks like the below.
01 MQCRTMH-CRTMSGHOPTS.
   COPY CMQCMHOV.

01 HMSG   PIC S9(18).

01 MQSETMP-SETMSGOPTS.
   COPY CMQSMPOV.

01 MQSETMP-NAME.
   COPY CMQCHRVV.

01 MQSETMP-PROPDESC.
   COPY CMQPDV.

MQSETMP-TYPE   PIC S9(9) BINARY.
MQSETMP-VALUELENGTH   PIC S9(9) BINARY.
MQSETMP-VALUE    PIC X(5).


Coding logic.

CALL 'MQCRTMH' USING HCONN
             MQCRTMH-CRTMSGHOPTS
             HMSG
             MQ-COMPCODE
             MQ-REASON   --> Call is successful

SET MQCHARV-VSPTR   TO ADDRESS OF MQSETMP-NAME
MOVE LENGTH OF MQSETMP-NAME  TO MQCHARV-VSLENGTH
MOVE 'Type1'         TO MQSETMP-VALUE

CALL 'MQSETMP' USING HCONN
            HMSG
            MQSETMP-SETMSGOPTS
            MQSETMP-NAME
            MQSETMP-PROPDESC
            MQSETMP-TYPE
            MQSETMP-TYPELENGTH
            MQSETMP-VALUE
            MQ-COMPCODE
            MQ-REASON   ---> 2442 is the reason code

MOVE 8 TO MQMD-MSGTYPE
MOVE 'MQSTR   ' TO MQMD-FORMAT
MOVE 'MQHRF2  ' TO MQMD-FORMAT
MOVE '1208'     TO MQRFH-NAMEVALUECCID
MOVE '273'      TO MQRFH-ENCODING
MOVE 'TEST MESSAGE' TO MQ-DATA


CALL 'MQPUT' USING HCONN
           HJ-OUTPUT
           MQMD-STRUC
           MQPMO-STRUC
           DATA-LEN
           MQ-DATA
           MQ-COMPCODE
           MQ-REASON  --> successful


I am getting all the values(Data and MQMD fields) as mentioned in the below expect user-defined property or attribute(Type1).
As i am new to MQ, Please let me know whether i have to use MQSETMP call like the above code or any logic needs to be implemented?

Expected Output:
Encoding : '273'
CodedCHarSetid : '1208'
Format : 'MQHRF2'
PutApplType: '1'
PutApplName :'APP1'
PutDate : '20051005-11114412880'
Type1 : TA123
Header 0: '<mcd><Msd>jms_text</Msd></mcd> '
Header 1: '<jms><Dst>queue:///MYQUEUE.SAMPLE.INPUT1 </Dst><Tms>14323
Header 2: '<usr><TimeStamp>Fri Jan,,,,,>
Message : TEST MESSAGE

Re: Doubt in MQSETMP

PostPosted: Fri Apr 28, 2017 2:13 am
by Robert Sample
Why don't you
DISPLAY '>' MQSETMP-NAME '<'
after the call to MQSETMP to see what the property name is that the system isn't liking? You KNOW that the property name is invalid because that's what a 2442 means, so why not find out what the value is and use that to fix your code? The Application Development Concepts manual lists the various invalid property names, so once you know what the property name is you should be able to identify why it is invalid and change it to be valid.