Inquiring about and setting the attributes of a queue
This example demonstrates how to use the MQINQ call to inquire about the attributes of a queue and to use the MQSET call to change the attributes of a queue.
This extract is taken from the Queue Attributes sample application (program CSQ4CAC1) supplied with IBM MQ for z/OS .⋮ DFHEISTG DSECT ⋮ OBJDESC CMQODA LIST=YES Working object descriptor * SELECTORCOUNT DS F Number of selectors INTATTRCOUNT DS F Number of integer attributes CHARATTRLENGTH DS F char attributes length CHARATTRS DS C Area for char attributes * OPTIONS DS F Command options HCONN DS F Handle of connection HOBJ DS F Handle of object COMPCODE DS F Completion code REASON DS F Reason code SELECTOR DS 2F Array of selectors INTATTRS DS 2F Array of integer attributes ⋮ OBJECT DS CL(MQ_Q_NAME_LENGTH) Name of queue ⋮ CALLLIST CALL,(0,0,0,0,0,0,0,0,0,0,0),VL,MF=L ********************************************************** * PROGRAM EXECUTION STARTS HERE * ⋮ CSQ4CAC1 DFHEIENT CODEREG=(R3),DATAREG=(R13) ⋮ * Initialize the variables for the set call * SR R0,R0 Clear register zero ST R0,CHARATTRLENGTH Set char length to zero LA R0,2 Load to set ST R0,SELECTORCOUNT selectors add ST R0,INTATTRCOUNT integer attributes * LA R0,MQIA_INHIBIT_GET Load q attribute selector ST R0,SELECTOR+0 Place in field LA R0,MQIA_INHIBIT_PUT Load q attribute selector ST R0,SELECTOR+4 Place in field * UPDTEST DS 0H CLC ACTION,CINHIB Are we inhibiting? BE UPDINHBT Yes branch to section * CLC ACTION,CALLOW Are we allowing? BE UPDALLOW Yes branch to section * MVC M00_MSG,M01_MSG1 Invalid request BR R6 Return to caller *
UPDINHBT DS 0H MVC UPDTYPE,CINHIBIT Indicate action type LA R0,MQQA_GET_INHIBITED Load attribute value ST R0,INTATTRS+0 Place in field LA R0,MQQA_PUT_INHIBITED Load attribute value ST R0,INTATTRS+4 Place in field B UPDCALL Go and do call * UPDALLOW DS 0H MVC UPDTYPE,CALLOWED Indicate action type LA R0,MQQA_GET_ALLOWED Load attribute value ST R0,INTATTRS+0 Place in field LA R0,MQQA_PUT_ALLOWED Load attribute value ST R0,INTATTRS+4 Place in field B UPDCALL Go and do call * UPDCALL DS 0H CALL MQSET, C (HCONN, C HOBJ, C SELECTORCOUNT, C SELECTOR, C INTATTRCOUNT, C INTATTRS, C CHARATTRLENGTH, C CHARATTRS, C COMPCODE, C REASON), C VL,MF=(E,CALLLIST) * LA R0,MQCC_OK Load expected compcode C R0,COMPCODE Was set successful? ⋮ * SECTION NAME : INQUIRE * * FUNCTION : Inquires on the objects attributes * * CALLED BY : PROCESS * * CALLS : OPEN, CLOSE, CODES * * RETURN : To Register 6 * INQUIRE DS 0H ⋮
* Initialize the variables for the inquire call * SR R0,R0 Clear register zero ST R0,CHARATTRLENGTH Set char length to zero LA R0,2 Load to set ST R0,SELECTORCOUNT selectors add ST R0,INTATTRCOUNT integer attributes * LA R0,MQIA_INHIBIT_GET Load attribute value ST R0,SELECTOR+0 Place in field LA R0,MQIA_INHIBIT_PUT Load attribute value ST R0,SELECTOR+4 Place in field CALL MQINQ, C (HCONN, C HOBJ, C SELECTORCOUNT, C SELECTOR, C INTATTRCOUNT, C INTATTRS, C CHARATTRLENGTH, C CHARATTRS, C COMPCODE, C REASON), C VL,MF=(E,CALLLIST) LA R0,MQCC_OK Load expected compcode C R0,COMPCODE Was inquire successful? ⋮Parent topic: System/390 assembler-language examples