Assembler to get name of current address space

  • Post category:Assembler
  • Reading time:2 mins read

Assembler program that gets the name of the current address space from the PSA’s current ASCB block.

Documentation: PSA description and ASCB description.

ASCBNAME CSECT                                                          
         EQUATES                                                        
         SAVE  (14,12),,TST/NDG/&SYSDATE/&SYSTIME/               
         USING ASCBNAME,R12            SET UP BASE ADDRESSABILITY       
         LR    R12,R15                 LOAD BASE REG WITH ENTRY POINT   
         LA    R14,SAVE                GET ADDRESS OF REGISTER SAVE     
         ST    R13,4(0,R14)            SAVE CALLER'S SAVE AREA ADDR     
         ST    R14,8(0,R13)            SAVE MY SAVE AREA ADDRESS        
         LR    R13,R14                 LOAD SAVE AREA ADDRESS           
*                                                                       
INIT     DS    0H                                                       
         OPEN  (OUT,(OUTPUT))
*                                                                       
DOE      DS    0H                                                       
         SR    R1,R1                   R1 = 0
         USING PSA,R1                  ADDRESS PSA
         L     R2,PSAAOLD              GET ADDRESS CURRENT ASCB
         DROP  R1                      RELEASE PSA ADDRESSING
         USING ASCB,R2                 ADDRESS CURRENT ASCB
         L     R1,ASCBJBNS             GET ADDRESS ADDRESS SPACE NAME
         DROP  R2                      RELEASE ASCB ADDRESSING
         MVC   ADDRSPC,0(R1)           GET NAME
         PUT   OUT,OUTREC              SCHRIJF                          
RETURN   DS    0H                                                       
         CLOSE OUT                                                      
         SLR   R15,R15                                                  
         L     R13,4(R13)              LOAD CALLERS SAVE AREA ADDRESS   
         RETURN (14,12),RC=(15)        RETURN TO CALLER                 
*                                                                       
*
*
         DC     C'**********   ************* WERKGEBIED ******'
SAVE     DS    18F
OUTREC   DS    CL80
         ORG   OUTREC
ADDRSPC  DC    CL8' '
REST     DC    CL72' '
OUT      DCB   DDNAME=OUT,                                             *
               DSORG=PS,                                               *
               MACRF=(PM)
*                                                                       
         IHAASCB DSECT=YES
         IHAPSA
         END   ,