BPX1WTE (wait extension) example

The following code uses the #WAIT3 function to wait for any of its children to end or stop. For the callable service, see wait-extension (BPX1WTE, BPX4WTE) — Obtain status information for children. For the data structures, see BPXYWAST — Map the wait status word and BPXYRLIM — Map the rlimit, rusage, and timeval structures. and BPXYCONS — Constants used by services. AMODE 64 callers use BPX4WTE (wait extension) example.
                                              
         LA    R15,WAST              Resolve address of WAST            
         ST    R15,WASTA             Save address of WAST               
         LA    R15,RUSAGE            Resolve address of RUSAGE          
         ST    R15,RUSAGEA           Save address of RUSAGE             
         SPACE ,                                                        
         CALL  BPX1WTE,              Wait for a child process to end   +
               (=A(#WAIT3),          Input: function      BPXYCONS     +
               0,                    Input: id type                    +
               0,                    Input: id                         +
               WASTA,                ->Exit status field, BPXTWAST     +
               =A(WNOHANG),          Input: options       BPXYCONS     +
               RUSAGEA,              ->Rusage structure,  BPXYRLIM     +
               RETVAL,               Return value: -1, 0, child PID    +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               VL,MF=(E,PLIST)       ----------------------------------