Author |
Message
|
wendy |
Posted: Fri Dec 19, 2003 4:40 am Post subject: Client connection in Cobol |
|
|
Apprentice
Joined: 10 Dec 2001 Posts: 47
|
I have two servers NT with queuemanager name QM1 and a unix server with QM2.The unix server has both client and server libraries installed.The NT only has server libraries.
I want to writing a cobol application on the unix server that has to connect to a remote queue manager,QM1 .My understanding is that the application has to use mqconnx as opposed to Mqconn because it is connecting as a client.
I have configured the environment variables to point to channel in QM 1.When I test the client installation on the unix server I run the amqsputc my test messages is put successfully on the NT server.
The cobol application is crashing on the MQConnx with return code of 2058.The parameter for QMgr name is QM1 and i have set default options for connectOptions.
When i set the Qmgr name to space the application connects to the local qmanager QM2.
Can you please help
(Urgent) |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Dec 19, 2003 4:58 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Please don't post the same question twice. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Fri Dec 19, 2003 8:32 am Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi Wendy,
You don't need to email me about your questions. If I have an answer for your posting when I'm reading it, I would post a response.
Quote: |
My understanding is that the application has to use mqconnx as opposed to Mqconn because it is connecting as a client. |
This is not true.
You are NOT required to use MQCONNX with MQ client programs. You have 2 choices: define the connectivity information within your program, hence, use MQCONNX, OR defined the connectivity information external to your program (i.e. MQSERVER environment variable or MQ Client Channel Table).
Note: You don't do both!!!
In your other posting, you talk about amqsputc and MQSERVER. amqsputc does NOT use MQCONNX, it uses MQCONN.
Therefore, my guess is that you have an invalid value in one of your MQCONNX parameters. Most likely it is either the hostname or the queue manager name (QMgrName is case sensitive and check your spelling!!).
One last item, if your COBOL program is simply connecting to a single queue manager then I would strongly suggest that you use MQCONN and set the MQSERVER environment.
Regards,
Roger Lacroix _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
wendy |
Posted: Tue Dec 30, 2003 10:23 pm Post subject: |
|
|
Apprentice
Joined: 10 Dec 2001 Posts: 47
|
Roger,
I have tried using MQConn and have set the MQSERVER variables to point to the NT Server ,QM1 on queue name LQ.TEST.01, but im getting error code 2058.
The Input Parameters For Mqconn Are Qmanager Name ,Qname I Have Specified The Correct Qmanager Name And Queue Name But Still Im Getting An Error on the completion and reason code.When I Try Setting The Qmanger Name To Space It Connects To The Local Qmanger Qm2 And That Is Not What I Want.I Want To Connect To The Remote Qmanager ,Qm1,Via The Mqserver Variables
When i use the amqsputc to test using the same queue name the message is put successfully on the queue LQ.TEST.01.
Does that mean i dont need to use the client libraries ?Currently I have used the cliuent libraries.
PLEASE HELP.Where am i going wrong? |
|
Back to top |
|
 |
JasonE |
Posted: Wed Dec 31, 2003 4:38 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
Quote: |
When I try setting the Qmanger name to space it connects to the local qmanger Qm2 |
That is because you have linked with the server bindings and Qm2 is the default qmgr name
Quote: |
I want to connect to the remote qmanager, Qm1, via the MQSERVER env variables. Does that mean i dont need to use the client libraries? Currently I have used the client libraries |
No you havent, as far as I can tell you are linking with the server libs. What commands are you using to build your pgm? |
|
Back to top |
|
 |
kman |
Posted: Fri Jan 02, 2004 1:11 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2003 Posts: 309 Location: Kuala Lumpur, Malaysia
|
Wendy,
1. Run the command dspmq, and post the output here.
2. Post the assignment code for your QManagerName from your Cobol.
3. Post your Cobol compile link instructions.
4. Also post the value of your MQSERVER exactly as it is spelled and displayed.
Then we can fiure out if you had 'misspelled' or you have linked to the wrong libs. |
|
Back to top |
|
 |
wendy |
Posted: Mon Jan 05, 2004 12:15 am Post subject: |
|
|
Apprentice
Joined: 10 Dec 2001 Posts: 47
|
Hi all,
Thanks for the help.
I could not attached is the zip file with the program that is failing,I think the option has been disabled. I have tried to paste the code at the bottom.I got this sample program from this site. The QManager LMT1NRES is the remote QManager. If I try the same program using the local queue manger it connect successfully and does a put.
Below are the requested outputs:
1.Command dspmq
QMNAME(LMD1UCOM) STATUS(Running)
The QMNAME(LMD1UCOM) is the local QMNAME. The remote QManager LMT1NRES,it is running on NT.
When I run the same command on the remote server I get the following results.
QMNAME(LMT1NRES) STATUS(Running)
QMNAME(LMT2NRES) STATUS(Running)
Please note that LMT1NRES is the default QManager,this is the QManager I am trying to connect to..
2.The MQSERVER environment variable is as follows(Unix):
MQSERVER=LMT1NRES.MQCLIENT.01/TCP/163.202.252.57
I have defined a server connection channel ,LMT1NRES.MQCLIENT.01, on the remote NT server.The IPAddress is for the remote NT Server.
Please note that the when i use amqsputc ,I am able to put a message successfully in a queue on the remote server.
Thanks,
Wendy
Code: |
*
*===============================================================
IDENTIFICATION DIVISION.
*===============================================================
*
PROGRAM-ID. MQCLIENT.
*
*---------------------------------------------------------------
*
*REMARKS
*
*---------------------------------------------------------------
*
*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
* Module Name : MQCLIENT
*
* Description : Program to make requests.
*
* Function : This program sends a request message to
* a server and wait for a reply.
*
* *************************************************************
*
*===============================================================
ENVIRONMENT DIVISION.
*===============================================================
*
*---------------------------------------------------------------
*
*
*---------------------------------------------------------------
*
*===============================================================
DATA DIVISION.
*===============================================================
*
*===============================================================
WORKING-STORAGE SECTION.
*===============================================================
*
*---------------------------------------------------------------
* GENERAL WORKING-STORAGE FIELDS
*---------------------------------------------------------------
*
01 WS-PRINT-LINE PIC X(79).
01 PROG-RETURN-CODE PIC S9(04) BINARY VALUE ZERO.
01 WS-MORE-FLAG PIC X VALUE 'N'.
01 WS-INPUT-BUFFER PIC X(1000).
01 WS-OUTPUT-BUFFER PIC X(1000).
01 INPUT-BUFFER-LENGTH PIC S9(9) BINARY VALUE 1000.
01 OUTPUT-BUFFER-LENGTH PIC S9(9) BINARY VALUE 1000.
01 COMP-CODE PIC S9(9) BINARY.
01 REASON-CODE PIC S9(9) BINARY.
*---------------------------------------------------------------
* Queue Manager fields
*---------------------------------------------------------------
01 WS-QUEUE-MGR PIC X(48) VALUE 'LMT1NRES'.
01 CON-HANDLE PIC S9(9) BINARY.
*---------------------------------------------------------------
* Output Queue fields
*---------------------------------------------------------------
01 WS-OUTPUT-Q PIC X(48) VALUE 'LQ.TEST.01'.
01 OPO-OPTIONS PIC S9(9) BINARY.
01 OPO-Q-HANDLE PIC S9(9) BINARY.
*---------------------------------------------------------------
* Input Queue fields
*---------------------------------------------------------------
01 WS-INPUT-Q PIC X(12) VALUE 'LQ.TEST.01'.
01 OPI-OPTIONS PIC S9(9) BINARY.
01 OPI-Q-HANDLE PIC S9(9) BINARY.
01 RETURNED-LENGTH PIC S9(9) BINARY.
*---------------------------------------------------------------
* Close Options
*---------------------------------------------------------------
01 CLS-OPTIONS PIC S9(9) BINARY.
*
*
*
01 PRT-LOG-MESSAGE.
05 PRT-LOG-TIME PIC X(8).
05 FILLER PIC X(2) VALUE SPACES.
05 PRT-COMMAND PIC X(10).
05 FILLER PIC X(13) VALUE ' COMP CODE = '.
05 PRT-COMP-CODE PIC 9(1).
05 FILLER PIC X(10) VALUE ' REASON = '.
05 PRT-REASON-CODE PIC 9(4).
05 FILLER PIC X(37) VALUE SPACES.
*
*
*
01 MQM-OBJECT-DESCRIPTOR.
COPY CMQODV.
01 MQM-MESSAGE-DESCRIPTOR.
COPY CMQMDV.
01 MQM-GET-MESSAGE-OPTIONS.
COPY CMQGMOV.
01 MQM-PUT-MESSAGE-OPTIONS.
COPY CMQPMOV.
*
01 MQM-CONSTANTS.
COPY CMQV.
*
*===============================================================
PROCEDURE DIVISION.
*===============================================================
*
1000-MAIN SECTION.
PERFORM 2000-MQ-CONNECT.
IF COMP-CODE NOT = MQCC-OK
GO TO 1000-MAIN-END.
PERFORM 3000-MQ-OPEN-IN.
IF COMP-CODE NOT = MQCC-OK
GO TO 1000-MAIN-DISCONNECT.
PERFORM 3500-MQ-OPEN-OUT.
IF COMP-CODE NOT = MQCC-OK
GO TO 1000-MAIN-DISCONNECT.
*
*
* business logic
* put your code here
* ........
* ........
*
MOVE 'This is a test message.' TO WS-OUTPUT-BUFFER.
*
* Send a request
*
PERFORM 4000-MQ-PUT.
IF COMP-CODE NOT = MQCC-OK
GO TO 1000-MAIN-DISCONNECT.
*
* Get the reply message
*
PERFORM 4500-MQ-GET.
IF COMP-CODE NOT = MQCC-OK
GO TO 1000-MAIN-DISCONNECT.
*
* put more code here
* ........
* ........
*
*
1000-MAIN-DISCONNECT.
PERFORM 5500-MQ-CLOSE-OUT.
PERFORM 5000-MQ-CLOSE-IN.
PERFORM 6000-MQ-DISCONNECT.
1000-MAIN-END.
STOP RUN.
* -------------------------------------------------------------
* End of main logic
* -------------------------------------------------------------
*
* Connect to the local queue manager.
*
2000-MQ-CONNECT SECTION.
CALL 'MQCONN' USING WS-QUEUE-MGR
CON-HANDLE
COMP-CODE
REASON-CODE.
MOVE 'MQCONN' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.
2000-MQ-CONNECT-EXIT.
EXIT.
*
* Open input queue
*
3000-MQ-OPEN-IN SECTION.
*
MOVE MQOT-Q TO MQOD-OBJECTTYPE.
MOVE WS-INPUT-Q TO MQOD-OBJECTNAME.
*
COMPUTE OPI-OPTIONS = MQOO-INPUT-AS-Q-DEF +
MQOO-FAIL-IF-QUIESCING.
*
CALL 'MQOPEN' USING CON-HANDLE
MQOD
OPI-OPTIONS
OPI-Q-HANDLE
COMP-CODE
REASON-CODE.
*
MOVE 'MQOPEN' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.
3000-MQ-OPEN-IN-EXIT.
EXIT.
*
* Open output queue
*
3500-MQ-OPEN-OUT SECTION.
MOVE MQOT-Q TO MQOD-OBJECTTYPE.
MOVE WS-OUTPUT-Q TO MQOD-OBJECTNAME.
COMPUTE OPO-OPTIONS = MQOO-OUTPUT +
MQOO-FAIL-IF-QUIESCING.
*
CALL 'MQOPEN' USING CON-HANDLE
MQOD
OPO-OPTIONS
OPO-Q-HANDLE
COMP-CODE
REASON-CODE.
*
MOVE 'MQOPEN' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.
3500-MQ-OPEN-OUT-EXIT.
EXIT.
*
* Write a message to a queue.
*
4000-MQ-PUT SECTION.
COMPUTE MQPMO-OPTIONS = MQPMO-NO-SYNCPOINT +
MQPMO-FAIL-IF-QUIESCING.
MOVE WS-INPUT-Q TO MQMD-REPLYTOQ.
MOVE WS-INPUT-Q TO MQMD-MSGTYPE.
*
CALL 'MQPUT' USING CON-HANDLE
OPO-Q-HANDLE
MQMD
MQPMO
OUTPUT-BUFFER-LENGTH
WS-OUTPUT-BUFFER
COMP-CODE
REASON-CODE.
*
MOVE 'MQPUT' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.
4000-MQ-PUT-EXIT.
EXIT.
*
* Read a message from the queue.
*
4500-MQ-GET SECTION.
MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID.
*
COMPUTE MQGMO-OPTIONS = MQGMO-WAIT +
MQGMO-ACCEPT-TRUNCATED-MSG +
MQGMO-NO-SYNCPOINT +
MQGMO-FAIL-IF-QUIESCING.
* Wait up to 30 seconds.
MOVE 30000 TO MQGMO-WAITINTERVAL.
*
CALL 'MQGET' USING CON-HANDLE
OPI-Q-HANDLE
MQMD
MQGMO
INPUT-BUFFER-LENGTH
WS-OUTPUT-BUFFER
RETURNED-LENGTH
COMP-CODE
REASON-CODE.
*
MOVE 'MQGET' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.
4500-MQ-GET-EXIT.
EXIT.
*
* Close input queue
*
5000-MQ-CLOSE-IN SECTION.
*
MOVE MQCO-NONE TO CLS-OPTIONS.
*
CALL 'MQCLOSE' USING CON-HANDLE
OPI-Q-HANDLE
CLS-OPTIONS
COMP-CODE
REASON-CODE.
*
MOVE 'CLOSE' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.
5000-MQ-CLOSE-IN-EXIT.
EXIT.
*
* Close output queue
*
5500-MQ-CLOSE-OUT SECTION.
MOVE MQCO-NONE TO CLS-OPTIONS.
*
CALL 'MQCLOSE' USING CON-HANDLE
OPO-Q-HANDLE
CLS-OPTIONS
COMP-CODE
REASON-CODE.
*
MOVE 'CLOSE' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.
5500-MQ-CLOSE-OUT-EXIT.
EXIT.
*
* Disconnect from the queue manager
*
6000-MQ-DISCONNECT SECTION.
CALL 'MQDISC' USING CON-HANDLE
COMP-CODE
REASON-CODE.
*
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE 'MQDISC' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.
6000-MQ-DISCONNECT-EXIT.
EXIT.
*
* This section prints all data lines produced by the program
*
8000-PRINT-LINE SECTION.
DISPLAY WS-PRINT-LINE.
MOVE SPACES TO WS-PRINT-LINE.
*
8000-PRINT-LINE-END.
EXIT.
*
* -------------------------------------------------------------
* End of the program
* -------------------------------------------------------------
|
Below is the content for file used to compile
Code: |
COBCPY=/compass_2/preprod/batch/copy:/compass_lib/mqmcomp/lpbsource_2:/compass_lib/mqmcomp/lpbsourceprod:/compa
ss_lib/mqmcomp/sourceprod
while (true)
do
read inf
if [ $? -eq 0 ]
then
echo $inf | grep COB
if [ "$?" -ne "0" ]
then
banner ERROR
echo Invalid input file specified or empty lines!!!!
exit
fi
inf1=`echo $inf| sed 's/.COB//'`
name=/compass_lib/mqmcomp/lpbsource_2/$inf1
echo $name
rm $name.o $name.cbl $name.int $name.idy $name.lst $name.lis
echo "build1 $name" $name.COB
echo $ORACLE_SID "Neales echo"
$ORACLE_HOME/bin/procob18_32 userid=interface/milktart@lpbdev iname=$name.COB oname=$name.cbl include
=/compass_2/preprod/batch/copy
echo "START COBOL"
cob32 $name.cbl -C IBMCOMP -vxgcP -C DEFAULTBYTE=0 -C use=cobol.dir -C COPYEXT=COB,CBL,CPY -L$ORACLE_
HOME/lib32 -L$ORACLE_HOME/network/lib32 -L/usr/lib -L/usr/lib/abi -lsql $ORACLE_HOME/network/lib32/osntab.o //
opt/mqm/lib/libmqmcbrt.o -lnsgr9 -lnls9 -lcore9 -lsocket -lnsl -lm -ldl -lmqic -lthread -lmqmcs
else
exit
fi
done < $1
|
I hope this informatrion is sufficient. |
|
Back to top |
|
 |
JoePanjang |
Posted: Mon Jan 05, 2004 12:57 am Post subject: |
|
|
Voyager
Joined: 10 Jul 2002 Posts: 88 Location: Dengkil MALAYSIA
|
You probably want to put the port number at your mqserver parm. Noticed that you had 2 qmgrs on the same server. _________________ Every good deed is charity... |
|
Back to top |
|
 |
wendy |
Posted: Mon Jan 05, 2004 2:42 am Post subject: |
|
|
Apprentice
Joined: 10 Dec 2001 Posts: 47
|
I have now included the port number, 1414, on the MQSERVER environment variable but im still getting the error 2058.
I think the problem is the compiling program .I think i have some libraries missing or something,just not sure.
 |
|
Back to top |
|
 |
JasonE |
Posted: Mon Jan 05, 2004 3:13 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
Unfortunately COBOl is not my strongpoint, but from some searches it appears that the libary libmqmcbrt is for cobol apps interacting with cics? (I could be completely wrong here....). Shouldnt you be using mqicb (or mqicb_r?)?
What platform, product, version and csd btw? |
|
Back to top |
|
 |
GLL0905 |
Posted: Mon Jan 05, 2004 4:54 am Post subject: |
|
|
Apprentice
Joined: 25 Jun 2001 Posts: 40 Location: gauteng, sa
|
Unix-Sun solaris system.
SunOS 5.8 Generic_108528-23 sun4u sparc SUNW,Ultra-Enterprise-10000 |
|
Back to top |
|
 |
kman |
Posted: Mon Jan 05, 2004 7:48 pm Post subject: |
|
|
Partisan
Joined: 21 Jan 2003 Posts: 309 Location: Kuala Lumpur, Malaysia
|
Wendy, I think your compile instructions, like you said, is not correct. If you are using libmqmcrt, that sounds like Micro Focus COBOL with COBOL CICS. I also did not see you linking with client libraries - libmqicb.so. I also thought that the lmqic is for C client, and not COBOL ( I may be wrong here! ).
Maybe you need to revisit the Application Programming Guide on the Building Your Application On Solaris, section Preparing COBOL Program.  |
|
Back to top |
|
 |
tkane |
Posted: Tue Jan 06, 2004 10:40 am Post subject: |
|
|
 Voyager
Joined: 23 Dec 2002 Posts: 82 Location: Kansas City
|
Wendy,
I'll weigh in with my 2 cents. Not sure if you got past the point where you've validated your MQSERVER and are not sure it's a problem like that on Unix.
I do 2 tests, one is a telnet test.
1) From Unix telnet host-name 1414
This will attempt to connect via port 1414 and show me that I have a network betweeen the two machines. It can be helpfull if there is a firewall.
2) I run a script that uses the sample programs to put or get from the queue.
Code: |
export MQSERVER="CLIENT.CHL.NAM/TCP/myhost.com(1414)"
echo $MQSERVER
QL="TEST.QUEUE"
echo "now putting to $QL"
# /var/mqm/support.PAC.bin/mgetc -bch $QL
/opt/mqm/samp/bin/amqsputc $QL
echo "now getting from $QL"
/opt/mqm/samp/bin/amqsgetc $QL |
I was cleaning up my scripts one time and didn't EXPORT the MQSERVER. That failed me. But I think it was 2059.
Give these a try.
Tom |
|
Back to top |
|
 |
|