5.1.15 MQSeries Programs

All programs will return at least a status and message. The status is a string value or an MQ API reason code prefixed with the string MQR.

JSMMQDEPTH - Depth of queue

 

Parameter

Description

I/O

Type

Len

Dec

JSMQMGR

Queue Manager

I

CHAR

48

 

JSMQNAME

Queue

I

CHAR

48

 

JSMDEPTH

Queue depth

O

DEC

8

0

JSMSTS

Status

O

CHAR

20

 

JSMMSG

Message

O

CHAR

256

 

 

The JSMMQDEPTH program is standalone and can be called without a JSM service being opened.

Example

 

CALL PGM(JSMMQDEPTH) PARM(#JSMQMGR #JSMQNAME #JSMDEPTH #JSMSTS #JSMMSG) NUM_LEN(*DEFINED)

 

JSMMQGET - Get message from queue

 

Parameter

Description

I/O

Type

Len

Dec

JSMQMGR

Queue Manager

I

CHAR

48

 

JSMQNAME

Queue

I

CHAR

48

 

JSMWAIT

Wait time (millisecs, -1 for unlimited. )

I

DEC

8

0

JSMMSIZE

Message size (0 is 20K | value). This is a helper size, if the size is too small the internal storage is reallocated to the size of the message and another get operation is performed.

I

DEC

8

0

JSMMID

Message Id. (*BLANK or message id)

I/O

CHAR

24

 

JSMCID

Correlation Id. (*BLANK or correlation id)

I/O

CHAR

24

 

JSMRQMGR

Reply Queue Manager

O

CHAR

48

 

JSMREPLYQ

Reply Queue

O

CHAR

48

 

JSMMTYPE

Message Type

O

DEC

9

0

JSMSTS

Status

O

CHAR

20

 

JSMMSG

Message

O

CHAR

256

 

 

When the LANSA function or RPG program receives the Message Id and Correlation Id, do not send these values across to the loaded JSM service, because they do not contain valid EBCDIC characters.

The Message Id and Correlation Id can be used to get a message that matches one or both of these input values, if you require the next message set the message id and correlation id fields to *BLANK before calling the JSMMQGET program.

Example

 

CHANGE FIELD(#JSMQMGR) TO('MY.QMANAGER')
CHANGE FIELD(#JSMQNAME) TO('MY.QUEUE')
CHANGE FIELD(#JSMWAIT) TO(-1)
CHANGE FIELD(#JSMSIZE) TO(0)
CHANGE FIELD(#JSMMID) TO(*BLANK)
CHANGE FIELD(#JSMCID) TO(*BLANK)
 
CALL PGM(JSMMQGET) PARM(#JSMQMGR #JSMQNAME #JSMWAIT #JSMMSIZE #JSMMID #JSMCID #JSMRQMGR #JSMREPLYQ #JSMMTYPE #JSMSTS #JSMMSG) NUM_LEN(*DEFINED)

 

JSMMQPUT - Put message on queue

 

Parameter

Description

I/O

Type

Len

Dec

JSMQMGR

Queue Manager

I

CHAR

48

 

JSMQNAME

Queue

I

CHAR

48

 

JSMCCSID

Message CCSID (0 for queue default)

I

DEC

8

0

JSMPST

Persistence (Y | N | *BLANK for default )

I

CHAR

1

 

JSMPTY

Priority (0 to 9 | -1 for queue default )

I

DEC

8

0

JSMMID

Message Id (*BLANK for new message id)

I

CHAR

24

 

JSMCID

Correlation Id (*BLANK or value)

I

CHAR

24

 

JSMMTYPE

Message Type
8 - MQMT_DATAGRAM
65536-999999999 - User defined

I

DEC

9

0

JSMRQMGR

Reply Queue Manager

I

CHAR

48

 

JSMREPLYQ

Reply Queue

I

CHAR

48

 

JSMSTS

Status

O

CHAR

20

 

JSMMSG

Message

O

CHAR

256

 

Optional

 

 

 

 

 

JSMEXPIRY

Expiry, milliseconds, -1 for unlimited (default)

I

DEC

9

0

JSMUSER

User

I

CHAR

12

 

 

When you use the optional JSMEXPIRY parameter, you must also pass the JSMUSER parameter as well. Failing to pass the JSMUSER parameter will cause the JSMMQPUT operation to fail.

Example

 

CHANGE FIELD(#JSMCCSID) TO(0)
CHANGE FIELD(#JSMMTYPE) TO(8)
CHANGE FIELD(#JSMMID) TO(*BLANK)
CHANGE FIELD(#JSMCID) TO(*BLANK)
CHANGE FIELD(#JSMPST) TO(Y)
CHANGE FIELD(#JSMPTY) TO(4)
CHANGE FIELD(#JSMRQMGR) TO(*BLANK)
CHANGE FIELD(#JSMREPLYQ) TO(*BLANK)
 
CALL PGM(JSMMQPUT) PARM(#JSMQMGR #JSMQNAME #JSMCCSID #JSMPST #JSMPTY #JSMMID #JSMCID #JSMMTYPE #JSMRQMGR #JSMREPLYQ #JSMSTS #JSMMSG) NUM_LEN(*DEFINED)

 

If the MQSeries MQCONN or MQPUT API call fails the current message is put to a recovery file JSMMQPUT if it exists. If the message length exceeds 32000 bytes the data is truncated.

The DDS source for physical file JSMMQPUT is in QDDSRC file in the JSM library.

 
DATE       8A      CCYYMMDD
TIME       6A      HHMMSS
JOBNUMBER  6A      000000
QUEUE      48A
MANAGER    48A
CCSID      8P 0
PERSIST    1A
PRIORITY   8P 0
USERID     12A
EXPIRY     9P 0
MESSAGEID  24A
CORRLATEID 24A
MSGTYPE    9P 0
RELYMGR    48A
RELYQUEUE  48A
MSGLENGTH  9P 0
MESSAGE    32000A

 

Also see

MQSeries and DataQueue programs Example