Using the ADDRESS command
When you issue a CONNECT command and an API processing thread is established, two control fields are created in the MVS™ address space or CICS® system where the program is running.
By requesting the addresses of these thread control fields, you can determine if asynchronous output is available without the need for polling or suspending processing.
You can use the ADDRESS ECB() SENTINEL() command to request the
addresses of these fields:
- ECB
- The ECB is posted by the API each time an asynchronous request
completes and is added to the thread's outstanding data queue. With
the ECB address, you can:
- Test the appropriate MVS post bits to determine if output is available.
- Issue an MVS WAIT command in a batch, TSO, or NetView® program.
- Issue an EXEC CICS WAITCICS or WAIT EXTERNAL command in a CICS program.
- SENTINEL
- The sentinel is a 4-byte counter of completed asynchronous requests
associated with the thread. The sentinel value increases each time an asynchronous request completes. Examples of completed asynchronous requests include:
- An event occurs that is named in a LISTEN command
- A command that was issued with the NOWAIT option completes processing.
Note:
- You should use the ADDRESS command before issuing the RECEIVE command. If the sentinel value is 0, it means there are no completed asynchronous requests to be received.
- Because of the nature of asynchronous processing, the sentinel value may understate the actual number of outstanding requests at any point in time. When processing multiple asynchronous requests, you should issue the RECEIVE IMMEDIATE command until a response of NODATA is returned to ensure that all output has been received.