Connecting to a queue manager

This example demonstrates how to use the MQCONN call to connect a program to a queue manager in z/OS batch. This extract is taken from the Browse sample program (CSQ4BAA1) supplied with WebSphere MQ for z/OS.



  ·
  ·
  ·
WORKAREA DSECT * PARMLIST CALL ,(0,0,0,0,0,0,0,0,0,0,0),VL,MF=L * COMPCODE DS F Completion code REASON DS F Reason code HCONN DS F Connection handle ORG PARMADDR DS F Address of parm field PARMLEN DS H Length of parm field * MQMNAME DS CL48 Queue manager name * * ********************************************************** * SECTION NAME : MAINPARM * ********************************************************** MAINPARM DS 0H MVI MQMNAME,X'40' MVC MQMNAME+1(L'MQMNAME-1),MQMNAME * * Space out first byte and initialize * * * Code to address and verify parameters passed omitted * * PARM1MVE DS 0H SR R1,R3 Length of data LA R4,MQMNAME Address for target BCTR R1,R0 Reduce for execute EX R1,MOVEPARM Move the data * ********************************************************** * EXECUTES * ********************************************************** MOVEPARM MVC 0(*-*,R4),0(R3) * EJECT
**********************************************************
*  SECTION NAME : MAINCONN                               *
**********************************************************
*
*
MAINCONN DS    0H
         XC    HCONN,HCONN       Null connection handle
*
         CALL  MQCONN,                          X
               (MQMNAME,                        X
               HCONN,                           X
               COMPCODE,                        X
               REASON),                         X
               MF=(E,PARMLIST),VL
*
         LA    R0,MQCC_OK       Expected compcode
         C     R0,COMPCODE      As expected?
         BER   R6               Yes .. return to caller
*
         MVC   INF4_TYP,=CL10'CONNECT   '
         BAL   R7,ERRCODE             Translate error
         LA    R0,8                   Set exit code
         ST    R0,EXITCODE            to 8
         B     ENDPROG                End the program
*