View previous topic :: View next topic |
Author |
Message |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Fri Dec 15, 2006 6:39 am Post subject: unable to Put Message in the Queue |
|
|
Hai All,
I am trying to put a message in the queue but i am failing to do so and i get a code of 2039 which implies that
Code: |
Queue not open for output.
An MQPUT call was issued to put a message on a queue,but the queue had not been opened for output.
Corrective action:
Specify MQOO_OUTPUT when the queue is opened.
|
My code:
Code: |
01 WS-PUTOPTIONS PIC S9(9) BINARY.
01 WS-MESSAGE PIC X(80) VALUE 'ABCDE'.
COMPUTE WS-PUTOPTIONS = MQPMO-SYNCPOINT +
MQOO-OUTPUT.
INITIALIZE WS-MSGBUFFER.
MOVE WS-MESSAGE TO WS-MSGBUFFER.
MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID.
MOVE MQENC-NATIVE TO MQMD-ENCODING.
MOVE MQCCSI-Q-MGR TO MQMD-CODEDCHARSETID.
MOVE MQFMT-STRING TO MQMD-FORMAT.
MOVE LENGTH OF WS-MSGBUFFER TO WS-MSGLENGTH.
CALL 'CSQBPUT' USING WS-HCONN
WS-HOBJ
MQMD
WS-MSGLENGTH
WS-MSGBUFFER
WS-DATALENGTH
WS-PUTOPTIONS
WS-COMPCODE
WS-REASON.
|
I am unable to figure out why the Put is unsuccessful .Can anybody help me the exact syntax for Putting a Message in the Queue as well as the contents of the Copybook if we use any .Can i know by any means whether i have the authority to put a message in the queue or not.Please help me out. _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12383 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
bob_buxton Beginner

Joined: 20 Dec 2002 Posts: 44 Topics: 0 Location: Hampshire, England
|
Posted: Fri Dec 15, 2006 8:17 am Post subject: |
|
|
Before you can put to to a queue you have to open it for output using MQOPEN,
you dont show your open call in your code extract.
Alternatively you can use MQPUT1 which combines MQOPEN/MQPUT/MQCLOSE into a single call.
Put options should be a structure mapped by MQPMOV copy book
There are sample Cobol program shipped with the product which will show you how to use each of the calls _________________ Bob Buxton
Ex Websphere MQ for zOS development |
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Fri Dec 15, 2006 8:47 am Post subject: |
|
|
Thanks Kolusu and Bob both of you.
I have Basically opened the Queue for Input and i am reading the messages one by by from the queue and finally i am trying to put message in the same queue for which is failing for me and my reading of messages is successful .Please guide me further . _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
bob_buxton Beginner

Joined: 20 Dec 2002 Posts: 44 Topics: 0 Location: Hampshire, England
|
Posted: Fri Dec 15, 2006 9:00 am Post subject: |
|
|
You can combine open options
compute open-options = MQOO-OUTPUT +
MQOO-INPUT-SHARED
MQOO-FAIL-IF-QUIESCING _________________ Bob Buxton
Ex Websphere MQ for zOS development |
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Fri Dec 15, 2006 9:16 am Post subject: |
|
|
Bob,
I am still facing the same problem and my code is below:
Code: |
COMPUTE WS-PUTOPTIONS = MQPMO-SYNCPOINT +
MQOO-OUTPUT +
MQOO-INPUT-SHARED +
MQOO-FAIL-IF-QUIESCING.
INITIALIZE WS-MSGBUFFER.
MOVE WS-MESSAGE TO WS-MSGBUFFER.
MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID.
MOVE MQENC-NATIVE TO MQMD-ENCODING.
MOVE MQCCSI-Q-MGR TO MQMD-CODEDCHARSETID.
MOVE MQFMT-STRING TO MQMD-FORMAT.
MOVE LENGTH OF WS-MSGBUFFER TO WS-MSGLENGTH.
CALL 'CSQBPUT' USING WS-HCONN
WS-HOBJ
MQMD
WS-MSGLENGTH
WS-MSGBUFFER
WS-DATALENGTH
WS-PUTOPTIONS
WS-COMPCODE
WS-REASON.
|
Can u please suggest me ahead ? _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
bob_buxton Beginner

Joined: 20 Dec 2002 Posts: 44 Topics: 0 Location: Hampshire, England
|
Posted: Fri Dec 15, 2006 10:50 am Post subject: |
|
|
The MQOO options are Open options and go with your call to MQOPEN.
You also still haven't used the PMO structure on your MQPUT which you should set up in a similar way to the GMO structure used with MQGET _________________ Bob Buxton
Ex Websphere MQ for zOS development |
|
Back to top |
|
 |
bob_buxton Beginner

Joined: 20 Dec 2002 Posts: 44 Topics: 0 Location: Hampshire, England
|
Posted: Fri Dec 15, 2006 10:55 am Post subject: |
|
|
Also you you don't have the put parameters in the correct order for MQPUT
Please look at a working sample program and copy from that _________________ Bob Buxton
Ex Websphere MQ for zOS development |
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Sun Dec 17, 2006 1:38 am Post subject: |
|
|
Bob,
Can i have the PMO Structure and i am new to MQ Programming and i do not have any sample programs as such and can u let me kow what is the order of the PUT Parameters in MQPUT call ? _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
bob_buxton Beginner

Joined: 20 Dec 2002 Posts: 44 Topics: 0 Location: Hampshire, England
|
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Mon Dec 18, 2006 8:05 am Post subject: |
|
|
Bob and Kolusu,
I am trying to debug the problem why i am not able to put Messages in the Queue and i finally have the Reason Code 2046 which says as below:
[code:1:a3773a8d1a]
+-----+--------------------------------+--------+------------------------ _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Tue Dec 19, 2006 1:56 am Post subject: |
|
|
Bob & Kolusu,
I have tried all options and finally i was able to put a message on the Queue successfully and basically i was lagging in coding proper MQPMO Structure and MQPMO-OPTIONS.
Here is the Structure:
Code: |
*****************************************************************
* Values Related to MQPMO Structure **
*****************************************************************
05 MQPMO.
** Structure identifier
15 MQPMO-STRUCID PIC X(4) VALUE 'PMO '.
** Structure version number
15 MQPMO-VERSION PIC S9(9) BINARY VALUE 1.
** Options that control the action of MQPUT and MQPUT1
15 MQPMO-OPTIONS PIC S9(9) BINARY VALUE 0.
** Reserved
15 MQPMO-TIMEOUT PIC S9(9) BINARY VALUE -1.
** Object handle of input queue
15 MQPMO-CONTEXT PIC S9(9) BINARY.
** Number of messages sent successfully to local queues
15 MQPMO-KNOWNDESTCOUNT PIC S9(9) BINARY.
** Number of messages sent successfully to remote queues
15 MQPMO-UNKNOWNDESTCOUNT PIC S9(9) BINARY.
** Number of messages that could not be sent
15 MQPMO-INVALIDDESTCOUNT PIC S9(9) BINARY.
** Resolved name of destination queue
15 MQPMO-RESOLVEDQNAME PIC X(48).
** Resolved name of destination queue manager
15 MQPMO-RESOLVEDQMGRNAME PIC X(48).
** Number of put message records or response records present
15 MQPMO-RECSPRESENT PIC S9(9) BINARY.
** Flags indicating which MQPMR fields are present
15 MQPMO-PUTMSGRECFIELDS PIC S9(9) BINARY.
** Offset of first put message record from start of MQPMO
15 MQPMO-PUTMSGRECOFFSET PIC S9(9) BINARY.
** Offset of first response record from start of MQPMO
15 MQPMO-RESPONSERECOFFSET PIC S9(9) BINARY.
** Address of first put message record
15 MQPMO-PUTMSGRECPTR POINTER.
** Address of first response record
15 MQPMO-RESPONSERECPTR POINTER.
** PUT-MESSAGE OPTIONS
15 MQPMO-SYNCPOINT PIC S9(9) BINARY VALUE 2.
15 MQPMO-NO-SYNCPOINT PIC S9(9) BINARY VALUE 4.
15 MQPMO-NO-CONTEXT PIC S9(9) BINARY VALUE
16384.
15 MQPMO-DEFAULT-CONTEXT PIC S9(9) BINARY VALUE 32.
15 MQPMO-PASS-IDENTITY-CONTEXT PIC S9(9) BINARY VALUE 256.
15 MQPMO-PASS-ALL-CONTEXT PIC S9(9) BINARY VALUE 512.
15 MQPMO-SET-IDENTITY-CONTEXT PIC S9(9) BINARY VALUE 1024.
15 MQPMO-SET-ALL-CONTEXT PIC S9(9) BINARY VALUE 2048.
15 MQPMO-ALTERNATE-USER-AUTHORITY PIC S9(9) BINARY VALUE 4096.
15 MQPMO-FAIL-IF-QUIESCING PIC S9(9) BINARY VALUE 8192.
15 MQPMO-NONE PIC S9(9) BINARY VALUE 0.
|
Program code:
Code: |
COMPUTE MQPMO-OPTIONS = MQPMO-NO-SYNCPOINT +
MQPMO-DEFAULT-CONTEXT.
CALL 'CSQBPUT' USING WS-HCONN
WS-HOBJ
MQMD
MQPMO
WS-MSGLENGTH
WS-MSGBUFFER
WS-DATALENGTH
WS-COMPCODE
WS-REASON.
|
OUTPUT
Code: |
WS-COMPCODE = 0
MQCC-OK = 0
|
Thanks both of you for u needful suggestion. _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
siva_marthala Beginner
Joined: 20 Mar 2007 Posts: 7 Topics: 2 Location: Pune
|
Posted: Tue Aug 05, 2008 7:14 am Post subject: |
|
|
Hi Shekar123
I am very new to MQ series programming. i read some documentation and still have few queries.
1. Please clarify, whether we GET all messages from SOURCE queue one by one and then PUT all messages in TARGET queue one by one
OR like COBOL READ and WRITE we GET one message from queue and PUT the same in output queue.
please clarify.
Thanks
Siva |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue Aug 05, 2008 8:52 am Post subject: |
|
|
what are your going to do with the first message, if you have not written it, when you receive your second message?
MQS queues are nothing but i/o devices.
unlike qsam files (vsam, etc..), you can completely define the i/o activity with the FD and select statements (as well as dd statements in jcl).
dealing with mqs is like dealing with db2.
you have a certain syntax to follow;
to receive data from or send data to, you have to follow the conventions. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
siva_marthala Beginner
Joined: 20 Mar 2007 Posts: 7 Topics: 2 Location: Pune
|
Posted: Tue Aug 05, 2008 11:55 pm Post subject: |
|
|
Can please send me the skeleton COBOL source for
copying one MQ queue to another MQ queue read non-destructively.
my sequence of paras as follows.
open input mq queue with MQOO-BROWSE option
open output mq queue with MQOO-OUTPUT option
get first message with MQGMO-BROWSE-FIRST option
put first message with PERSISTANCE option
get next messages with MQGMO-BROWSE-NEXT option
put messages with PERSISTANCE option
close input mq queue
close output mq queue |
|
Back to top |
|
 |
|
|