Tivoli Header

Administrator's Guide


Sample Assembler User Exit (ANRUSRXS)

Figure 105. ANRUSRXS

ANRUSRXS TITLE '*** EventLogging UserExit: AMODE 31 / RMODE 31 ***'
ANRUSRXS START 0
ANRUSRXS AMODE 31
ANTUSRXS RMODE ANY
**********************************************************************
*               ANRUSRXS ... Tivoli Storage Manager                  *
**********************************************************************
*  Licensed Materials - Property of IBM                              *
*  5697-ISM,5698-ISM                                                 *
*  (C) Copyright IBM Corp. 1990, 2002                                *
*  All rights reserved.                                              *
*                                                                    *
*  US Government Users Restricted Rights - Use, duplication          *
*  or disclosure restricted by GSA ADP Schedule Contract             *
*  with IBM Corp.                                                    *
*--------------------------------------------------------------------*
*
*  This is a sample ASSEMBLER language program that can be used as
*  a user exit for event logging.  The name of this program does not
*  have to be ANRUSRXS; it can be given a valid name and it's name
*  must be specified in the USEREXIT server option statement.
*
*  On entry to this exit, the following registers will be set:
*
*    Reg 1 = Address of fullword that contains address of the
*            data structure containing the event information
*            (refer to ANRUSRXA sample).
*
*    Reg 13 = Address of save area
*    Reg 14 = Return address
*    Reg 15 = Entry address of this program
*
*  Prior to returning to the TSM Server, Reg 15 must be set to 0,
*  all registers must be restored as saved on entry, and return to
*  address in Reg 14.
*
*  Processing considerations:
*    - Allocate storage that can be used by this program as a dynamic
*      storage area; release the storage prior to returning to the
*      TSM Server.
*    - This sample program allocates storage for the dynamic storage
*      area below the 16 meg line; storage can be obtained from either
*      above or below the 16 meg line since AMODE 31 & RMODE ANY were
*      specified.
*
*  Note:
*    - This sample program can also be used to create a FILETEXTEXIT
*      program for event logging. The server passes to a FILETEXTEXIT
*      program a pointer to a storage area that contains event info in
*      a readable text format (refer to the Administrator's Guide
*      to obtain a description of the readable text area; no sample
*      DSECT for FILETEXTEXIT area is supplied).
*
*---------------------------------------------------------------------
*  EQUATE THE REGISTERS TO SYMBOLS ......
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R6       EQU   6
R7       EQU   7
R8       EQU   8
R9       EQU   9
R10      EQU   10
R11      EQU   11
R12      EQU   12
R13      EQU   13
R14      EQU   14
R15      EQU   15
         SPACE
         USING *,R10               Base reg is 10
         STM   R14,R12,12(R13)     Save caller's registers
         LR    R10,R15             Set base address
         LR    R9,R1               Copy Parm List address
*
         LA    R4,MYDSAL           Length of dynamic area
         STORAGE OBTAIN,LENGTH=(4),LOC=BELOW Get dynamic storage area
         LTR   R15,R15             Did obtain work ??
         BNZ   GETOUT                No, just return
         LR    R11,R1              Reg 11 = This prog's DSA
         USING MYDSA,R11
         LA    R3,MYSAVE           This prog's save area
         ST    R3,8(,R13)          Put into caller's save area
         ST    R13,MYSAVE+4        Save caller's save area address
         LR    R13,R3              R13 = this prog's save area addr
         L     R3,0(,R9)           R3 = address of passed data
         USING ANRUSRXA,R3
*
         MVI   LN3A,C'+'
         MVI   LN3B,C'+'
         MVI   LN3T,X'40'
         MVC   LN3T+1(LN3L-3),LN3T
         MVC   LN3T+2(17),=C'Entry address is:'
         LA    R9,LN3L
         STH   R9,LN3              Length of line
*
         LR    R9,R10              Entry addr into Reg9
         LA    R7,8                Gonna loop 8 times
         LA    R6,LN3T+21          Start of output area
*
LOOP1    DS    0H                  Convert hex to displayable
         XR    R8,R8               Reg8 = 0
         SLDL  R8,4                4 bits from Reg9 into Reg8
         STC   R8,0(,R6)           Save the byte in outarea
         LA    R6,1(,R6)           Next outarea
         BCT   R7,LOOP1            Loop 8 times (Reg7 init to 8)
         TR    LN3T+21(8),HEXDIG   Convert hex to displayable
*
         L     R5,ANREVNT#         R5 = Event# (in binary)
         CVD   R5,WORKDW           Convert it to packed decimal
         MVC   LN4,LINED
         MVC   LN4+6(15),=C'Message Number:'
         MVC   LN4+22(6),=X'402020202120'
         ED    LN4+22(6),WORKDW+5  Make Event# displayable
*
         LH    R5,ANRSEVCD         R5 = Severity code (in binary)
         CVD   R5,WORKDW           Convert it to packed decimal
         MVC   LN5,LINED
         MVC   LN5+6(15),=C'Severity ......'
         MVC   LN5+22(4),=X'4B202120'
         ED    LN5+22(4),WORKDW+6  Make Severity code displayable
*
         MVC   LN6,LINED
         MVC   LN6+6(15),=C'Server Name ...'
         LA    R5,ANRSRVRN         R5 = Start of Server Name
         LA    R6,65               R6 = Maximum length
*
LOOP2    DS    0H                  Find the end of the name
         CLI   0(R5),0             Current byte : x'00'
         BE    GETNAME             It is x'00', then determine length
         LA    R5,1(,R5)           Point to next byte to the right
         BCT   R6,LOOP2            Do scan to max length of name
         LA    R5,ANRSRVRN+8       Too long, default to 8 chars
*
GETNAME  DS    0H                  Determine length of name
         LA    R6,ANRSRVRN         R6 = Start of Server Name
         SR    R5,R6               Determine length
         BCTR  R5,0                Decrement by 1
         LA    R7,LN6+22           Addr of where name goes
         EX    R5,DOMVC            Move name to output area
*
         LA    R2,LN1
         LA    R3,LN2
         LA    R5,LN3
         LA    R6,LN4
         LA    R7,LN5
         LA    R8,LN6
         WTO   TEXT=(2)            Write the data
         WTO   TEXT=(3)            Write the data
         WTO   TEXT=(5)            Write the data
         WTO   TEXT=(6)            Write the data
         WTO   TEXT=(7)            Write the data
         WTO   TEXT=(8)            Write the data
         WTO   TEXT=(2)            Write the data
*
         L     R5,MYSAVE+4         Reg5 = caller's save area addr
         LA    R4,MYDSAL           Length of dynamic area
         STORAGE RELEASE,LENGTH=(4),ADDR=(11) Return dynamic area
         LR    R13,R5              Reg13 = caller's save area addr
         SR    R15,R15             Return code set to 0
*
GETOUT   DS    0H
         L     R14,12(,R13)        Load return address
         LM    R0,R12,20(R13)      Load caller's Regs 0-12
         BR    R14                 Return to caller
*
DOMVC    MVC   0(0,R7),0(R6)
HEXDIG   DC    C'0123456789ABCDEF'
LN1      DC    AL2(LN1L)
L1T      DC    C'+------------------------------------+'
LN1L     EQU   *-L1T
*
LN2      DC    AL2(LN2L)
L2T      DC    C'+  AMODE31/RMODEANY routine entered. +'
LN2L     EQU   *-L2T
*
LINED    DC    AL2(LINEDL)
LINEDT   DC    C'+                                    +'
LINEDL   EQU   *-LINEDT
*
         LTORG
*
MYDSA    DSECT
MYSAVE   DC    18F'0'
*
WORKDW   DS    D
*
LN3      DS    AL2
LN3A     DS    CL1
LN3T     DS    CL36
LN3B     DS    CL1
LN3L     EQU   *-LN3A
*
LN4      DS    CL40
LN5      DS    CL40
LN6      DS    CL40
*
         DS    D
*
MYDSAL   EQU   *-MYSAVE
*
         COPY  ANRUSRXA
*
         END
 
 


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]