Assembler

Beispiel: Assembler

* ------------------------------------------------------------------- *
** based on an IBM Sample -                                          **
** MVS Programming: Authorized Assembler Services Guide              **
* ------------------------------------------------------------------- *
SYSRXAS1 CSECT
SYSRXAS1 AMODE 31
SYSRXAS1 RMODE ANY
         BAKR  R14,0
         LR    R12,R15
         USING SYSRXAS1,R12
         MODID BR=YES
         LR    R10,R1
         C     R10,=F'0'            REG1 ZERO?
         BE    CONTINUE
         L     R10,0(R10,0)         SAVE PARM ADDR
         LH    R3,0(R10)            LENGTH OF PARM
         LA    R10,2(,R10)          GET PAST LENGTH
         CH    R3,=H'8'             IS THERE A RIGHT PARM? LGT 3
         BH    CONTINUE
         CH    R3,=H'1'             IS THERE A RIGHT PARM? LGT 3
         BL    CONTINUE
         MVC   kMaster,=CL8' '
         BCTR  R3,0                 minus 1
         EX    R3,MVCPARM
CONTINUE EQU   *
*
*  TITLE: GetAste
*
*  Function:  Obtain the address of MASTER's aste by invoking
*     an exec to parse the output of DISPLAY JOBS,*MASTER*.
*     The following exec takes a jobname as an input argument
*     and sets the variable OutAste#.
*
************************************************************
         XC    MyArgLst,MyArgLst    Clear the ArgLst header
         XC    MyVarLst,MyVarLst    Clear the VarLst header
         XC    MyArgEn1,MyArgEn1    Clear the Arg entry
         XC    MyVarEn1,MyVarEn1    Clear the Var entry
*-------------------------------------------------------
         LA    2,MyArgLst
         USING AxrArgLst,2
         MVC   AxrArgLstId,MyAxrArgLstAcro
         LA    5,AxrArgLstCurVer
         ST    5,AxrArgLstVer       Initialize the version
         L     5,kNumArgs           Obtain the number of arguments
         STH   5,AxrArgLstNumber   Store the number of arguments
         DROP  2
         USING AxrArgEntry,2
         LA    2,MyArgEn1          Addressability to first arg entry
         LA    5,kMaster
         ST    5,AXRARGADDRLOW      Store address of jobname (*master*)
         OI    AXRARGINPUTFLGS1,AXRARGINPUT Indicate input arg
         LA    5,L'kMaster          Obtain length of arg
         ST    5,AXRARGLENGTH       Store length of arg in entry
         MVI   AxrArgType,AxrArgTypeChar  Store type of arg
         DROP  2
*-------------------------------------------------------
         LA    2,MyVarLst
         USING AxrArgLst,2
         MVC   AxrArgLstId,MyAxrVarLstAcro
         LA    5,AxrArgLstCurVer
         ST    5,AxrArgLstVer       Initialize the version
         L     5,kNumVars           Obtain the number of variables
         STH   5,AxrArgLstNumber   Store the number of variables
         DROP  2
         USING AxrArgEntry,2
         LA    2,MyVarEn1           Addressability to 1st var entry
         LA    5,OutAste#
         ST    5,AXRARGADDRLOW      Store output argument
         LA    5,OutArgName
         ST    5,AXRARGNameADDRLOW Store address of name of output var
         MVI   AxrArgNameLength,L'OutArgName
         OI    AXRARGINPUTFLGS1,AXRARGOutput   Indicate output var
         MVI   AxrArgType,AxrArgTypeHexString     Indicate hex string
         LA    5,L'OutAste#         Obtain length (in bytes)
         SLL   5,1      Mult by 2 - length is in hex digits (not bytes)
         ST    5,AxrArgLength       Store length in var entry
         DROP  2
         MODESET MODE=SUP
*-------------------------------------------------------
         AXREXX REQUEST=EXECUTE,NAME=kEXECNAME,REXXARGS=MyArgLst,      *
               REXXVARS=MyVarLst,REXXDIAG=MyAxrDiag,                   *
               REXXOUTDSN=MyOutDsn
         LTR   15,15
         JNZ   FailLabel
         MODESET MODE=PROB
         USING AxrDiag,2
         LA    2,MyAxrDiag
         TM    AxrDiagFlgs1,AxrDiagNoExecRetCode
         JNZ   FailLabel
         L     15,AxrDiagExecRetCode
         LTR   15,15
         JNZ   FailLabel
*-------------------------------------------------------
*        Everything looks good.  Process OutAste# here
* OutAste# should contain Master's ASTE address
         BAL   R14,DISPLAY_HEX
         J     EndLabel
FailLabel DS   0H
         MODESET MODE=PROB
ENdLabel  DS   0H
* Perform error checking
         PR
***********************************************************************
*                                                                     *
* Display Message                                                     *
*                                                                     *
***********************************************************************
*
DISPLAY_HEX EQU  *
         STM   R1,R15,SAVEDIS
         LA    R3,OutAste#             Start of Data to show
         LA    R7,TOSHOWR              Result
         LA    R4,4(,R3)               End of Compare
         MVC   FIRP,FIRPC              Clear
         MVC   SECP,SECPC              Clear
LOOP_HEXIT EQU *                       LOOP THROUGH ALL CHARS
         SLR   R5,R5                   CLEAR
         SLR   R6,R6                   CLEAR
         ICM   R5,1,0(R3)              GET CHAR
         LR    R6,R5                   GET CHAR
         N     R5,=X'0000000F'
         O     R5,=X'000000F0'
         ST    R5,SECP                 SECOND PART
         N     R6,=X'000000F0'
         SRA   R6,4(0)
         O     R6,=X'000000F0'
         ST    R6,FIRP                 FIRST PART
         SLR   R6,R6
         LA    R6,TRANSNUM             USE TRANSLATE FOR
         SL    R6,TRANSC0                CHANGING X'FX' TO X'CX'
         TR    FIRP+3(1),0(R6)             EX : X'FA' -> X'CA'
         TR    SECP+3(1),0(R6)             EX : X'FA' -> X'CA'
         MVC   0(1,R7),FIRP+3          SAVE RESULT
         MVC   1(1,R7),SECP+3          SAVE RESULT
         LA    R7,2(R7)                NEXT OUTPUT
         LA    R3,1(R3)                NEXT INPUT
         CLR   R3,R4                   THE END?
         BL    LOOP_HEXIT
         MVC   WTO_IT+8(8),KMaster
         MVC   WTO_IT+22(8),TOSHOWR
WTO_IT   WTO   '12345678 ASTE=12345678'
         LM    R1,R15,SAVEDIS
         BR   R14                        Return
***********************************************************************
                DS 0F
MVCPARM  MVC   kMaster(0),0(R10)
MyAxrArgLstAcro DC AL4(AxrArgLstAcro)
MyAxrVarLstAcro DC AL4(AxrVarLstAcro)
kExecName       DC CL8'MYREXX1 '
kMaster         DC CL8'*MASTER*'
OUTArgName      DC CL8'OUTASTE#'
MyOutDsn        DC CL44'YVES.SYSTREXX'
FIRP            DC X'00000000'
SECP            DC X'00000000'
FIRPC           DC X'00000000'
SECPC           DC X'00000000'
*
TRANSC0  DC    XL3'00'             ADDRESS OF BEGIN OF TRANS TABLE
         DC    C'0'                     1RST CHAR OF TRANSLATE
TRANSNUM DC    C'0123456789ABCDEF'      TRANSLATE TABLE FOR HEXIT
*
TOSHOWR         DC CL8' '
                DS 0F
SAVEDIS         DS 16F
TOSHOW          DC A(0)
DOUBLE          DC D'0'
kNumArgs        DC  F'1'
kNumVars        DC  F'1'
MyArgLst        DS CL(AXRARGLST_LEN)
MyArgEn1        DS CL(AXRARGENTRY_LEN)
MyVarLst        DS CL(AXRARGLST_LEN)
MyVarEn1        DS CL(AXRARGENTRY_LEN)
MyAxrDiag       DS CL(AXRDIAG_LEN)
OutAste#        DS A
         AXRZARG DSECT=YES,AXRARGLST=YES,AXRARGENTRY=YES,AXRDIAG=YES
*
         YREGS ,
         END   ,
*/