BPX4SEL (select) example

The following code issues a select for a previously connected socket. SOCKDESC was returned when the socket was created. In this case, the select is for a single socket for read, write and exception. Do not request waiting. There are no ECBs. For the callable service, see select/selectex (BPX1SEL, BPX4SEL) — Select on file descriptors and message queues. For the data structures, see BPXYSOCK — Map SOCKADDR structure and constants and BPXYSEL — Map the select options. AMODE 31 callers use BPX1SEL (select) example.
                                              
         SPACE ,                                                        
*                                                                       
         MVC   SELLIST(4),=XL4'81000000'                               +
                                     Turn on the bit representing sd 0 +
                                     and sd 7                           
         LA    R8,8                  One more than largest descriptor   
         ST    R8,SOCKDESC           Set number of sockets to check     
*                                                                       
         CALL  BPX4SEL,              Select on a set of sockets        +
               (SOCKDESC,            Input: Number of file descriptors +
               =A(4),                Input: Length of read list        +
               SELLIST,              Input: Read list                  +
               =A(4),                Input: Length of write list       +
               SELLIST,              Input: Write list                 +
               =A(4),                Input: Length of exception list   +
               SELLIST,              Input: Exception list             +
               =AD(0),               Input: Address of Timeout value   +
               =AD(0),               Input: ECB pointer                +
               =A(SEL#BITSFORWARD),  Input: Option - bits forward      +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ----------------------------------