MQSeries Built-in Function

********** Beginning of RDML commands **********

FUNCTION OPTIONS(*DIRECT)

DEFINE     FIELD(#JSMCNT) TYPE(*CHAR) LENGTH(4)

DEFINE     FIELD(#JSMGET) TYPE(*CHAR) LENGTH(4)

DEFINE     FIELD(#JSMPUT) TYPE(*CHAR) LENGTH(4)

DEFINE     FIELD(#JSMSTS) TYPE(*CHAR) LENGTH(20)

DEFINE     FIELD(#JSMMSG) TYPE(*CHAR) LENGTH(255)

DEFINE     FIELD(#QMANAGER) TYPE(*CHAR) LENGTH(48)

DEFINE     FIELD(#QNAME) TYPE(*CHAR) LENGTH(48)

DEFINE     FIELD(#QMODE) TYPE(*CHAR) LENGTH(10)

**********

DEFINE     FIELD(#WAIT) TYPE(*DEC) LENGTH(9) DECIMALS(0)

DEFINE     FIELD(#LENGTH) TYPE(*DEC) LENGTH(9) DECIMALS(0)

DEFINE     FIELD(#GETMSGID) TYPE(*CHAR) LENGTH(24)

DEFINE     FIELD(#GETCORID) TYPE(*CHAR) LENGTH(24)

DEFINE     FIELD(#RQMANAGER) TYPE(*CHAR) LENGTH(48)

DEFINE     FIELD(#RQNAME) TYPE(*CHAR) LENGTH(48)

DEFINE     FIELD(#JSMMSGID) TYPE(*CHAR) LENGTH(24) DECIMALS(0)

DEFINE     FIELD(#JSMCORID) TYPE(*CHAR) LENGTH(24) DECIMALS(0)

DEFINE     FIELD(#MSGTYPE) TYPE(*DEC) LENGTH(9) DECIMALS(0)

DEFINE     FIELD(#MSGFMT) TYPE(*CHAR) LENGTH(8)

DEFINE     FIELD(#DEPTH) TYPE(*DEC) LENGTH(9) DECIMALS(0)

**********

DEFINE     FIELD(#CCSID) TYPE(*DEC) LENGTH(9) DECIMALS(0)

DEFINE     FIELD(#PRIORITY) TYPE(*DEC) LENGTH(9) DECIMALS(0)

DEFINE     FIELD(#EXPIRY) TYPE(*DEC) LENGTH(9) DECIMALS(0)

DEFINE     FIELD(#PERSIST) TYPE(*CHAR) LENGTH(1)

DEFINE     FIELD(#QUSER) TYPE(*CHAR) LENGTH(12)

DEFINE     FIELD(#APPLID) TYPE(*CHAR) LENGTH(32)

**********

********** Connect to queue manager

**********

CHANGE     FIELD(#QMANAGER) TO('USERAGENT.QUEUE.MANAGER')

USE        BUILTIN(MQ_CONN) WITH_ARGS(#QMANAGER) TO_GET(#JSMSTS #JSMMSG #JSMCNT)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

**********

********** Open GET queue

**********

CHANGE     FIELD(#QNAME) TO('USERAGENT.QUEUE')

USE        BUILTIN(MQ_OPEN) WITH_ARGS(#JSMCNT #QNAME 'IQ') TO_GET(#JSMSTS #JSMMSG #JSMGET)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

**********

********** Open PUT queue

**********

USE        BUILTIN(MQ_OPEN) WITH_ARGS(#JSMCNT #QNAME 'OFU') TO_GET(#JSMSTS #JSMMSG #JSMPUT)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

**********

********** Get GET queue depth

**********

USE        BUILTIN(MQ_DEPTH) WITH_ARGS(#JSMCNT #JSMGET) TO_GET(#JSMSTS #JSMMSG #DEPTH)

DISPLAY    FIELDS((#JSMSTS) (#DEPTH))

**********

********** Open JSM connection

**********

USE        BUILTIN(JSM_OPEN) TO_GET(#JSMSTS #JSMMSG)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

**********

USE        BUILTIN(JSM_COMMAND) WITH_ARGS('SERVICE_LOAD SERVICE(MQCLIENT)') TO_GET(#JSMSTS #JSMMSG)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

**********

********** Create XML message

**********

USE        BUILTIN(JSM_COMMAND) WITH_ARGS('SEND XSL(SENDORDER)') TO_GET(#JSMSTS #JSMMSG)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

**********

********** Put XML message

**********

CHANGE     FIELD(#CCSID) TO(37)

CHANGE     FIELD(#MSGFMT) TO(MQSTR)

CHANGE     FIELD(#MSGTYPE) TO(999999999)

CHANGE     FIELD(#PERSIST) TO('Y')

CHANGE     FIELD(#PRIORITY) TO(-1)

CHANGE     FIELD(#EXPIRY) TO(-1)

CHANGE     FIELD(#EXPIRY) TO(-1)

CHANGE     FIELD(#JSMMSGID) TO('MYMSG')

CHANGE     FIELD(#JSMCORID) TO('MYCOR')

CHANGE     FIELD(#RQMANAGER) TO('MYQMANAGER')

CHANGE     FIELD(#RQNAME) TO('MYQUEUE')

CHANGE     FIELD(#QUSER) TO('MYSELF')

CHANGE     FIELD(#APPLID) TO('MYAPPLID')

**********

USE        BUILTIN(MQ_PUT) WITH_ARGS(#JSMCNT #JSMPUT #MSGTYPE #MSGFMT #JSMMSGID #JSMCORID #RQMANAGER #RQNAME #CCSID #PERSIST #PRIORITY #EXPIRY #QUSER #APPLID) TO_GET(#JSMSTS #JSMMSG)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

**********

********** Get XML message

**********

CHANGE     FIELD(#WAIT) TO(35)

CHANGE     FIELD(#MSGTYPE) TO(0)

CHANGE     FIELD(#LENGTH) TO(100000)

CHANGE     FIELD(#JSMMSGID) TO(*BLANK)

CHANGE     FIELD(#JSMCORID) TO(*BLANK)

CHANGE     FIELD(#MSGFMT) TO(*BLANK)

CHANGE     FIELD(#MSGTYPE) TO(0)

CHANGE     FIELD(#RQMANAGER) TO(*BLANK)

CHANGE     FIELD(#RQNAME) TO(*BLANK)

CHANGE     FIELD(#QUSER) TO(*BLANK)

CHANGE     FIELD(#APPLID) TO(*BLANK)

**********

USE        BUILTIN(MQ_GET) WITH_ARGS(#JSMCNT #JSMGET #WAIT #LENGTH) TO_GET(#JSMSTS #JSMMSG #MSGTYPE #MSGFMT #JSMMSGID #JSMCORID #RQMANAGER #RQNAME #QUSER #APPLID)

DISPLAY    FIELDS((#JSMSTS) (#MSGTYPE) (#MSGFMT) (#RQMANAGER) (#RQNAME) (#JSMMSGID) (#JSMCORID) (#QUSER) (#APPLID) (#JSMMSG))

**********

********** Close JSM connection

**********

USE        BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

**********

********** Close GET queue

**********

USE        BUILTIN(MQ_CLOSE) WITH_ARGS(#JSMCNT #JSMGET) TO_GET(#JSMSTS #JSMMSG)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

**********

********** Close PUT queue

**********

USE        BUILTIN(MQ_CLOSE) WITH_ARGS(#JSMCNT #JSMPUT) TO_GET(#JSMSTS #JSMMSG)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

**********

********** Disconnect from queue manager

**********

USE        BUILTIN(MQ_DISC) WITH_ARGS(#JSMCNT) TO_GET(#JSMSTS #JSMMSG)

DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))

********** End of RDML commands **********