Reentrant entry linkage

This entry linkage is reentrant and saves the caller's registers, allocates a save area and dynamic storage, and establishes program and dynamic storage base registers. This entry linkage is paired with the return linkage that is located at the end of the executable program; see Reentrant return linkage. For an example of nonreentrant entry and return linkage, see Example of nonreentrant entry linkage—AMODE 31.
                                              
         TITLE 'Alphabetical syscall of z/OS UNIX callable services'    
BPXB1SM1 CSECT ,                     Reentrant entry linkage            
BPXB1SM1 AMODE 64                                                       
         SYSSTATE AMODE64=YES                                           
BPXB1SM1 RMODE ANY                                                      
@ENTRY0  J     @ENTRY1               Branch around program header       
         DC    C'BPXB1SM4 - Reentrant callable service examples'        
         DS    0H                    Ensure half word boundary          
@ENTRY1  STMG  R14,R12,12(R13)       Save caller's registers            
         LGR   R2,R13                Hold address of caller's area      
         LGR   R3,R1                 Hold parameter register            
         LGR   R12,R15               R12 program base register          
         LA    R11,2048(,R12)        Second program base register       
         LA    R11,2048(,R11)        Second program base register       
         LA    R9,2048(,R11)         Third  program base register       
         LA    R9,2048(,R9)          Third  program base register       
         LA    R4,2048(,R9)          Fourth program base register       
         LA    R4,2048(,R4)          Fourth program base register       
         LA    R7,2048(,R4)          Fifth  program base register       
         LA    R7,2048(,R7)          Fifth  program base register       
         USING @ENTRY0,R12,R11,R9,R4,R7 Program addressability          
         L     R0,@SIZEDAT           Size this program's getmain area   
         GETMAIN RU,LV=(0)           Getmain storage                    
         LGR   R13,R1                R13 -> this program's save area    
         LA    R10,2048(,R13)        Second getmain base register       
         LA    R10,2048(,R10)        Second getmain base register       
         LA    R6,2048(,R10)         Third  getmain base register       
         LA    R6,2048(,R6)          Third  getmain base register       
         USING @STORE,R13,R10,R6     Getmain addressability             
         STG   R2,@BACK              Save caller's save area pointer    
         STG   R13,136(,R2)          Give caller our save area          
         LR    R1,R3                 Restore parameter register         
@ENTRY2  EQU   *  *  *  *  *  *  *   End of the entry linkage code      
         SPACE ,                                                        
PSEUDO   EQU   *                     Dummy label used throughout