BPX4PTC (pthread_create) example

The following code creates a new thread. For the callable service, see pthread_cancel (BPX1PTB, BPX4PTB) — Cancel a thread. For the data structure, see BPXYPTAT — Map attributes for pthread_exit_and_get. AMODE 31 callers use BPX1PTC (pthread_create) example.
                                              
         LA    R15,BUFFERA           Work area                          
         STG   R15,BUFA              ->above                            
         LA    R15,PTAT              Area mapped by BPXYPTAT            
         STG   R15,PTATA             ->above                            
         MVC   PTATEYE,=C'BPXYPTAT'              Set the eye-catcher    
         MVC   PTATLENGTH,=A(PTATUSEROFFVAL)     Length of structure    
         MVC   PTATSYSOFFSET,=A(PTATSYSOFFVAL)   Sys attr offset        
         MVC   PTATSYSLENGTH,=A(PTATSYSLENVAL)   Sys attr length        
         MVC   PTATUSEROFFSET,=A(0)              User attr offset       
         MVC   PTATUSERLENGTH,=A(0)              User attr length       
         LOAD  EP=INITRTN            Get address of Init Rtn            
         STG   R0,INITRTNA                                              
         SPACE ,                                                        
         CALL  BPX4PTC,                                                +
               (INITRTNA,            Input: Init  routine address      +
               BUFA,                 Input: Work area address          +
               PTATA,                Input: Attr area Address BPXYPTAT +
               THID,                 Thread ID,  if Return value = 0   +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ----------------------------------