The SELECTEX call monitors a set of sockets, a time value,
and an ECB. It completes when either one of the sockets has activity,
the time value expires, or one of the ECBs is posted.
To use the SELECTEX call as a timer in your program, do
either of the following tasks:
- Set the read, write, and exception arrays to zeros.
- Specify MAXSOC ≤ 0.
Table 1. SELECTEX call requirementsCondition |
Requirement |
---|
Authorization: |
Supervisor state or problem state, any PSW key. |
Dispatchable unit mode: |
Task. |
Cross memory mode: |
PASN = HASN. |
Amode: |
31-bit or 24-bit.
|
ASC mode: |
Primary address space control (ASC) mode. |
Interrupt status: |
Enabled for interrupts. |
Locks: |
Unlocked. |
Control parameters: |
All parameters must be addressable by the caller
and in the primary address space. |
Figure 1 shows an example of
SELECTEX call instructions.
Figure 1. SELECTEX call
instruction exampleIf an application intends to pass a single ECB on the SELECTEX
call, then the corresponding working storage definitions and CALL
instruction should be coded as shown in the following example:
WORKING-STORAGE SECTION.
01 SOC-FUNCTION PIC X(16) VALUE IS 'SELECTEX'.
01 MAXSOC PIC 9(8) BINARY.
01 TIMEOUT.
03 TIMEOUT-SECONDS PIC 9(8) BINARY.
03 TIMEOUT-MINUTES PIC 9(8) BINARY.
01 RSNDMSK PIC X(*).
01 WSNDMSK PIC X(*).
01 ESNDMSK PIC X(*).
01 RRETMSK PIC X(*).
01 WRETMSK PIC X(*).
01 ERETMSK PIC X(*).
01 SELECB PIC X(4).
01 ERRNO PIC 9(8) BINARY.
01 RETCODE PIC S9(8) BINARY.
Where * is the size of the select mask
PROCEDURE DIVISION.
CALL 'EZASOKET' USING SOC-FUNCTION MAXSOC TIMEOUT
RSNDMSK WSNDMSK ESNDMSK
RRETMSK WRETMSK ERETMSK
SELECB ERRNO RETCODE.
However, if the application intends to pass the address of an ECB
list on the SELECTEX call, then the application must set the high
order bit in the ECB list address and pass that address using the
BY VALUE option as documented in the following example. The remaining
parameters must be set back to the default by specifying BY REFERENCE
before ERRNO:
WORKING-STORAGE SECTION.
01 SOC-FUNCTION PIC X(16) VALUE IS 'SELECTEX'.
01 MAXSOC PIC 9(8) BINARY.
01 TIMEOUT.
03 TIMEOUT-SECONDS PIC 9(8) BINARY.
03 TIMEOUT-MINUTES PIC 9(8) BINARY.
01 RSNDMSK PIC X(*).
01 WSNDMSK PIC X(*).
01 ESNDMSK PIC X(*).
01 RRETMSK PIC X(*).
01 WRETMSK PIC X(*).
01 ERETMSK PIC X(*).
01 ECBLIST-PTR USAGE IS POINTER.
01 ERRNO PIC 9(8) BINARY.
01 RETCODE PIC S9(8) BINARY.
Where * is the size of the select mask
PROCEDURE DIVISION.
CALL 'EZASOKET' USING SOC-FUNCTION MAXSOC TIMEOUT
RSNDMSK WSNDMSK ESNDMSK
RRETMSK WRETMSK ERETMSK
BY VALUE ECBLIST-PTR
BY REFERENCE ERRNO RETCODE.
* The bit mask lengths can be determined from the expression:
((maximum socket number +32)/32 (drop the remainder))*4