Locking messages on a queue
While browsing, applications can also place a lock on a given message. A lock limits other ECBs from viewing or acting on the message until the lock is released.
- Use the MQOPEN C function with the MQOO_BROWSE option specified to open a local or alias queue for browsing.
- Use the MQGET C
function to lock or unlock messages. Lock options are specified in
the Options field of the MQGMO structure and are as follows:
- MQGMO_LOCK
- Lock message.
- MQGMO_UNLOCK
- Unlock message.
Once the position of the cursor is changed, any message that was previously locked is unlocked.
When a lock is placed on a message that is on a processor shared queue, a copy of that locked message is made on the special-recovery queue (called SPECIAL.RECOVERY.QUEUE). This queue is used by transaction services to recover uncommitted messages on processor shared queues. The special-recovery queue allows for the recovery of locked messages when a processor is deactivated with the ZPSMS command (using the PROCESSOR and DEACTIVATE parameters). Once this command is entered, locked messages are recovered and unlocked from the special-recovery queue so that other processors can access the messages.
See the z/TPF C/C++ Language Support User's Guide for more information about the MQOPEN and MQGET C functions and also detailed information about the MQGMO structure and the browse options.