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 not taken from the sample applications supplied with WebSphere MQ.
%INCLUDE SYSLIB(CMQP); %INCLUDE SYSLIB(CMQEPP); : /****************************************************/ /* STRUCTURE BASED ON PARAMETER INPUT AREA (PARAM) */ /****************************************************/ DCL 1 INPUT_PARAM BASED(ADDR(PARAM)), 2 PARAM_LENGTH FIXED BIN(15), 2 PARAM_MQMNAME CHAR(48); ⋮ /****************************************************/ /* WORKING STORAGE DECLARATIONS */ /****************************************************/ DCL MQMNAME CHAR(48); DCL COMPCODE BINARY FIXED (31); DCL REASON BINARY FIXED (31); DCL HCONN BINARY FIXED (31); ⋮ /****************************************************/ /* COPY QUEUE MANAGER NAME PARAMETER */ /* TO LOCAL STORAGE */ /****************************************************/ MQMNAME = ' '; MQMNAME = SUBSTR(PARAM_MQMNAME,1,PARAM_LENGTH); ⋮ /****************************************************/ /* CONNECT FROM THE QUEUE MANAGER */ /****************************************************/ CALL MQCONN (MQMNAME, /* MQM SYSTEM NAME */ HCONN, /* CONNECTION HANDLE */ COMPCODE, /* COMPLETION CODE */ REASON); /* REASON CODE */ /****************************************************/ /* TEST THE COMPLETION CODE OF THE CONNECT CALL. */ /* IF THE CALL HAS FAILED ISSUE AN ERROR MESSAGE */ /* SHOWING THE COMPLETION CODE AND THE REASON CODE. */ /****************************************************/ IF COMPCODE ¬= MQCC_OK THEN DO; ⋮ CALL ERROR_ROUTINE; END;
Parent topic:
PL/I examples
fg19190_