Understanding the User Exit

This article provides a sample, and explains user exit C1BM7XIT. This user exit lets you specify an output library member for analysis when that member name is different than the input or source member name. You can also use the exit to bypass analysis for members by setting the return code appropriately. The following is the sample user exit C1BM7XIT:
ce
This article provides a sample, and explains user exit C1BM7XIT. This user exit lets you specify an output library member for analysis when that member name is different than the input or source member name. You can also use the exit to bypass analysis for members by setting the return code appropriately. The following is the sample user exit C1BM7XIT:
//*(JOBCARD) //********************************************************************* //*                                                                   * //*   C1BM7XIT - ASSEMBLE AN EXIT FOR USE WITH THE INVENTORY ANALYZER. * //*                                                                   * //*    STEP1 WILL ASSEMBLE THE MEMBER SPECIFIED INLINE                * //*                                                                   * //*    STEP2 WILL LINKEDIT THE MEMBER AND STORE IN USER LOADLIB       * //*                                                                   * //********************************************************************* //STEP1    EXEC PGM=ASMA90,PARM='NODECK,OBJECT,NOTERM' //SYSLIB   DD  DISP=SHR,DSN=iprfx.iqual.CSIQOPTN //         DD  DISP=SHR,DSN=SYS1.MACLIB //SYSLIN   DD  DISP=(,PASS,DELETE),DSN=&&SYSLIN., //             UNIT=tdisk,SPACE=(TRK,(3,5),RLSE), //             DCB=(RECFM=FB,LRECL=80,BLKSIZE=3120) //SYSPUNCH DD  DUMMY //SYSUT1   DD  UNIT=tdisk,SPACE=(CYL,(5,3)) //SYSPRINT DD  SYSOUT=* //SYSIN    DD   * C1BM7XIT TITLE 'SAMPLE USER EXIT FOR THE 
CA Endevor
 INVENTORY ANALYZER' *********************************************************************** *                                                                     * *  PROGRAM NAME:   ANALEXIT                                           * *                                                                     * *  DESCRIPTION:    SAMPLE USER EXIT FOR THE CASCMM INVENTORY          * *                  ANALYZER.                                          * *                                                                     * *                  THIS PROGRAM IS INTENDED TO DOCUMENT AND           * *                  DEMONSTRATE THE INVENTORY ANALYZER USER EXIT.      * *                                                                     * *                  THE EXIT IS INTENDED TO ALLOW SPECIFICATION OF     * *                  AN OUTPUT LIBRARY MEMBER NAME FOR ANALYSIS, WHEN   * *                  IT IS DIFFERENT FROM THE INPUT MEMBER NAME.        * *                                                                     * *                  IT IS ALSO POSSIBLE TO BYPASS MEMBER ANALYSIS      * *                  BY SETTING THE RETURN CODE APPROPRIATELY.          * *                                                                     * *********************************************************************** *                                                                     * *  ABOUT THIS EXAMPLE:                                                * *                                                                     * *                  THIS EXAMPLE IS INTENDED TO DEMONSTRATE HOW        * *                  AN EXIT MAY SPECIFY THE OUTPUT MEMBER NAME         * *                  TO BE USED IN A SITUATION WHERE THE SOURCE         * *                  MEMBER NAME IS NOT IDENTICAL TO THE OUTPUT         * *                  MEMBER NAME. WE WILL ALSO DEMONSTRATE HOW          * *                  TO BYPASS ANALYSIS FOR CERTAIN MEMBER NAMES.       * *                                                                     * *                  1)  THIS EXIT WILL TAKE ANY MEMBER NAMES THAT      * *                      CONTAIN CHARACTERS IN POSITIONS 9 AND 10       * *                      AND BUILD A MEMBER NAME USING POSITIONS        * *                      1-6, AND 9-10. THIS REPRESENTS A SITUATION     * *                      WHERE THE INPUT FILE MIGHT BE PANVALET AND     * *                      THE OUTPUT FILE IS A LOAD MODULE PDS.          * *                                                                     * *                  2)  THIS EXIT WILL BYPASS PROCESSING ANY MEMBERS   * *                      WHICH CONTAIN THE STRING "ABCDE" BEGINNING     * *                      IN THE SECOND POSITION OF THE SOURCE MEMBER    * *                      NAME.                                          * *                                                                       *********************************************************************** *                                                                     * *  REGISTERS UPON ENTRY:                                              * *                                                                     * *                  R0:  IGNORE                                        * *                  R1:  POINTER TO A THREE WORD PARAMETER LIST        * *                      WORD 1: ADDRESS OF 10 CHARACTER SOURCE         * *                              MEMBER NAME                            * *                      WORD 2: ADDRESS OF 10 CHARACTER OUTPUT         * *                              MEMBER NAME                            * *                      WORD 3: ADDRESS OF WORK AREA - DOUBLE WORD     * *                              ALIGNED. THIS WORK AREA IS 400         * *                              CHARACTERS IN SIZE (100 WORDS),        * *                              AND MAY HOLD INFORMATION BETWEEN       * *                              INVOCATIONS OF THE EXIT ROUTINE.       * *                  R2:  IGNORE                                        * *                  R3:  IGNORE                                        * *                  R4:  IGNORE                                        * *                  R5:  IGNORE                                        * *                  R6:  IGNORE                                        * *                  R7:  IGNORE                                        * *                  R8:  IGNORE                                        * *                  R9:  IGNORE                                        * *                  R10: IGNORE                                        * *                  R11: IGNORE                                        * *                  R12: IGNORE                                        * *                  R13: CALLERS SAVE AREA                             * * --PLEASE NOTE---->   THE FIRST WORD OF THIS SAVE AREA               * *                      MUST NOT BE MODIFIED.                          * *                  R14: RETURN ADDRESS                                * *                  R15: ENTRY POINT ADDRESS (ADDRESS OF "ANALEXIT")   * *                                                                     * *                                                                     * *  REGISTERS UPON RETURN:                                             * *                                                                     * *                  R0:  IGNORE                                        * *                  R1:  IGNORE                                        * *                  R2:  MUST BE RESTORED                              * *                  R3:  MUST BE RESTORED                              * *                  R4:  MUST BE RESTORED                              * *                  R5:  MUST BE RESTORED                              * *                  R6:  MUST BE RESTORED                              * *                  R7:  MUST BE RESTORED                              * *                  R8:  MUST BE RESTORED                              * *                  R9:  MUST BE RESTORED                              * *                  R10: MUST BE RESTORED                              * *                  R11: MUST BE RESTORED                              * *                  R12: MUST BE RESTORED                              * *                  R13: MUST BE RESTORED                              * *                  R14: IGNORE                                        * *                  R15: RESULT RETURN CODE                            * *                      RC = 0, CONTINUE EXECUTION, USE THE SOURCE     * *                              MEMBER NAME TO LOCATE THE OUTPUT,      * *                      RC = 4, CONTINUE EXECUTION, AN OUTPUT MEMBER   * *                              NAME HAS BEEN SUPPLIED IN THE          * *                              SECOND FIELD IN THE PARAMETER LIST.    * *                      RC = 8, TERMINATE PROCESSING OF THIS MEMBER    * *                                                                     * *                                                                     * *********************************************************************** *                                                                     * *  NOTE:  THIS EXIT MUST BE LINKED WITH PROGRAM C1BM7500 IN ORDER     * *         TO BE USED DURING PROCESSING. C1BM7500 CONTAINS A           * *         WEAK-UNRESOLVED REFERENCE TO A CSECT "ANALEXIT".            * *                                                                     * *  LINKAGE EDITOR INPUT:                                              * *                                                                     * *         INCLUDE SYSLMOD(C1BM7500)                                   * *         INCLUDE SYSLIB(C1BM7XIT) <- USE CORRECT OBJECT MEMBER NAME  * *         ENTRY C1BM7500                                              * *         NAME  C1BM7500(R)                                           * *                                                                     * *********************************************************************** *                                                                     * *  MODIFICATION LOG: (MOST RECENT CHANGES FIRST)                      * *                                                                     * *                                                                     * *  MODIFICATION   DATE   BY    DESCRIPTION                            * *  ------------   ----   ---   -------------------------------------- * *                                                                     * ***********************************************************************          EJECT *********************************************************************** *                                                                     * *  DEFINE THE MODULE NAME (CSECT) AND ENTRY POINT FOR LINKAGE         * *  EDITOR PROCESSING.                                                 * *                                                                     * *********************************************************************** C1BM7XIT CSECT          ENTRY ANALEXIT ANALEXIT EQU   C1BM7XIT          SPACE , *********************************************************************** *                                                                     * *  SAVE THE CALLERS REGISTER CONTENTS, TO BE RESTORED WHEN RETURNING. * *                                                                     * ***********************************************************************          SAVE  (14,12),, 'ANALEXIT-&SYSDATE-&SYSTIME'          SPACE , *********************************************************************** *                                                                     * *  THEN ESTABLISH SOME LOCAL ADDRESSABILITY                           * *                                                                     * ***********************************************************************          LR    R12,R15                 COPY ENTRY POINT ADDRESS          USING ANALEXIT,R12            INFORM THE ASSEMBLER          SPACE , *********************************************************************** *                                                                     * *  USING THE WORK AREA PROVIDED (PARM 3), ESTABLISH OUR OWN SAVE      * *  AREA AND WORK AREA.                                                * *                                                                     * ***********************************************************************          USING PARMAREA,R1             INFORM THE ASSEMBLER ABOUT THE  X                                        . PARMAREA          L     R2,PARM3                GET THE PARM 3 ADDRESS          ST    R13,4(R2)               SET BACK CHAIN IN NEW SAVEAREA          ST    R2,8(R13)               SET FORWARD CHAIN IN OLD SAVE          LR    R13,R2                  ESTABLISH THE CURRENT SAVEAREA          USING SAVEAREA,R13            INFORM THE ASSEMBLER          SPACE , *********************************************************************** *                                                                     * *  GET THE SOURCE AND OUTPUT MEMBER NAME ADDRESS INTO WORK REGISTERS  * *  SO THAT R1 MAY BE FREED FOR OTHER WORK (AS DESIRED).               * *                                                                     * ***********************************************************************          L     R2,PARM1                LET R1 POINT TO SOURCE MEMBER          L     R3,PARM2                LET R3 POINT TO OUTPUT MEMBER          DROP  R1                      (PARMAREA)          USING SOURCE,R2               INFORM THE ASSEMBLER          USING TARGET,R3               INFORM THE ASSEMBLER          SPACE , *********************************************************************** *                                                                     * *  CHECK IF THE SOURCE MEMBER NAME CONTAINS "ABCDE" BEGINNING         * *  IN THE SECOND POSITION.                                            * *                                                                     * ***********************************************************************          CLC   =C'ABCDE',INMBR+1       DESIRED DATA PRESENT?          BE    RETURN08                . YES, THEN SET RETURN CODE = 8          SPACE , *********************************************************************** *                                                                     * *  CHECK IF POSITIONS 9 AND 10 CONTAINS ANY DATA.                     * *                                                                     * ***********************************************************************          CLI   INMBR+8,C' '           ANY CHARACTER IN POSITION 9?          BNH   RETURN00                . NO, THEN RETURN WITH RC = 0          MVC   OUTMBR(6),INMBR         COPY POSITIONS 1-6 FROM INPUT   X                                        . TO THE OUTPUT MEMBER NAME          MVC   OUTMBR+6(2),INMBR+8     COPY POSITIONS 9-10 FROM INPUT  X                                        . TO THE OUTPUT MEMBER NAME          B     RETURN04                RETURN WITH RETURN CODE = 4          DROP  R2,R3                   (SOURCE,TARGET)          SPACE , *********************************************************************** *                                                                     * *  RETURN TO THE CALLER WITH THE APPROPRIATE RETURN CODE.             * *                                                                     * *********************************************************************** RETURN00 DS    0H          XR    R15,R15                 SET RETURN CODE = 0          B     PGMEXIT          SPACE , RETURN04 DS    0H          LA    R15,4                   SET RETURN CODE = 4          B     PGMEXIT          SPACE , RETURN08 DS    0H          LA    R15,8                   SET RETURN CODE = 8          B     PGMEXIT          SPACE ,          DROP  R13                     (SAVEAREA)          SPACE , PGMEXIT  DS    0H          L     R13,4(,R13)             GET CALLERS SAVE AREA ADDRESS          RETURN (14,12),,RC=(15)       RETURN          EJECT *********************************************************************** *                                                                     * *  PARM AREA DEFINITION                                               * *                                                                     * *********************************************************************** PARMAREA DSECT PARM1    DS    A                       ADDRESS OF SOURCE MEMBER NAME PARM2    DS    A                       ADDRESS OF OUTPUT MEMBER NAME PARM3    DS    A                       ADDRESS OF SUPPLIED WORK AREA          SPACE 3 *********************************************************************** *                                                                     * *  SOURCE MEMBER NAME DEFINITION                                      * *                                                                     * *********************************************************************** SOURCE   DSECT INMBR    DS    CL10                    INPUT MEMBER NAME          SPACE 3 *********************************************************************** *                                                                     * *  TARGET MEMBER NAME DEFINITION                                      * *                                                                     * *********************************************************************** TARGET   DSECT OUTMBR   DS    CL10                    OUTPUT MEMBER NAME          SPACE 3 *********************************************************************** *                                                                     * *  SAVE AREA AND WORK AREA DEFINITION                                 * *                                                                     * *********************************************************************** SAVEAREA DSECT          DS    18F                     RESERVE THE FIRST 18 WORDS AS *                                      THE ACTUAL SAVE AREA. WORKAREA DS    0D                      THIS IS THE BEGINNING OF THE *                                      WORK AREA ***  A TOTAL OF 100 WORDS ARE PROVIDED IN THIS SAVEAREA/WORKAREA. ***  THE SAVE AREA ITSELF TAKES THE FIRST 18, LEAVING 82 WORDS ***  (328 BYTES) AVAILABLE AS A WORK AREA.          EJECT *********************************************************************** *                                                                     * *  REGISTER EQUATE  DEFINITIONS                                       * *                                                                     * *********************************************************************** 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          END /* //* //STEP2    EXEC PGM=IEWL,PARM='LIST,NCAL,XREF,SIZE=(256K,64K) ', //             COND=(0,NE) //SYSLIB   DD  DISP=(OLD,DELETE),DSN=&&SYSLIN. //SYSLMOD  DD  DISP=SHR,DSN=uprfx.uqual.LOADLIB //SYSUT1   DD  UNIT=tdisk,SPACE=(CYL,(5,3)) //SYSPRINT DD  SYSOUT=* //SYSLIN   DD  *   INCLUDE  SYSLMOD(C1BM7500)   INCLUDE  SYSLIB   ENTRY  C1BM7500   NAME   C1BM7500(R) /* //