The DEQUSRQ (Dequeue User Queue) API dequeues a message from a keyed or FIFO/LIFO user queue. This API frees a HLL programmer from dealing with the DEQ instruction directly when dequeuing a user queue.
Num | Parameter Name | Input/Output | Parameter Type and Length | Remark |
1 | Queue Object | in | char(20) | Queue name and queue library, e.g. 'Q_NAME Q_LIB' |
2 | Time Enqueued | out | char(26) | Timestamp in ISO format |
3 | Wait Flag | in | char(1) | '0', do NOT wait; '1', wait |
4 | Timeout Value | in | bin(4) | Timeout value in seconds. A negative timeout value means to wait indefinitely. If wait flag is set to '0', this parameter is ignored. |
5 | Access-state Flag | in | char(1) | '0', do not modify the PAG access state; '1', modify the PAG access state |
6 | MPL Option | in | char(1) | '0', leave current MPL; '1', remain in current MPL |
7 | Key Data | in/out | char(*) | On input, represents the selection key; on output, contains the key data of the dequeued messsage |
8 | Key Relation | in | char(2) | The relation bwteen the actual key and the selection key. Valid inputs are: 'GT', 'LT', 'NE', 'EQ', 'GE', 'LE'. |
9 | Key Length | in | bin(4) | Input key length, must be equal to or greater than actural key length of a user queue. |
10 | Key Length Returned | out(4) | bin(4) | The actural key length of the user queue or 0 if the queue is non-keyed. |
11 | Message Text | out | char(*) | Message text of the dequeued message. |
12 | Message Text Length | in | bin(4) | Length of user provied buffer. |
13 | Message Text Length Available | out | bin(4) | Actual message text length of the dequeued message |
The Key Data represents the selection key on input and contains the key data of the dequeued messsage on output.
Valid inputs of Key Relation include: 'GT', 'LT', 'NE', 'EQ', 'GE', 'LE'. If an invalid key relation value is specified, DEQUSRQ raises CPF9504.
If an invalid Key Length is specified, DEQUSRQ raises CPF9507 and returns the proper key length in Key Length Returned.
d q_obj s 20a inz('Q61 LSBIN') d timeout_val s 10i 0 inz(604800) /* 1 week */ d keylen_in s 10i 0 inz(5) /* key length = 5 */ d keylen_out s 10i 0 d msglen_in s 10i 0 inz(16) d msglen_out s 10i 0 c call 'DEQUSRQ' c parm q_obj c parm enq_time 26 c parm '1' use_timeout 1 /* wait */ c parm timeout_val c parm '1' mod_acc_sts 1 c parm '0' mpl_option 1 c parm 'ABCDE' key 5 /* selection key: 'ABCDE' */ c parm 'GE' key_relation 2 /* dequeue messages whose key greater than 'ABCDE' */ c parm keylen_in c parm keylen_out c parm msg 16 c parm msglen_in c parm msglen_out c seton lr