BPX1WAT (wait) example

The following code waits for any of its children to end or stop. For the callable service, see wait (BPX1WAT, BPX4WAT) — Wait for a child process to end. For the data structure, see BPXYWAST — Map the wait status word and BPXYCONS — Constants used by services. AMODE 64 callers use BPX4WAT (wait) example.
                                              
         LA    R15,WAST              Resolve address of STATUS          
         ST    R15,WASTA             Save address of STATUS             
         MVC   PROCID,=F'-1'         Wait for any child                 
         SPACE ,                                                        
         CALL  BPX1WAT,              Wait for a child process to end   +
               (PROCID,              Input: PID being waited on        +
               =A(WNOHANG),          Input: options       BPXYCONS     +
               WASTA,                ->Exit status field, BPXTWAST     +
               RETVAL,               Return value: -1, 0, child PID    +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               VL,MF=(E,PLIST)       ----------------------------------