Previous Topic: 7.2.2.1 Global Account Code Exit Routine (ACCTRTE)

Next Topic: 7.2.2.3 Spool Level Account Code Specification

7.2.2.2 Step-Level Account Code Specification


The global account code exit routine, ACCTRTE, described in
the previous section, sets account codes (ACCTNOx) for every
CA MICS database observation written for the job, TSO
session, started task, or address space records from an
APPC/MVS Transaction Program (TP).

Some sites allow account code specification in the JCL EXEC
statement for individual program steps.  Other sites want to
set account codes based on the program executed.  The ACCTRTE
is only executed once for a given address space.  The account
code values set in ACCTRTE rely on job-level information.
CA MICS enables you to override the global ACCTNOx account
code values for each step or interval record prior to output
to the CA MICS step-level files.

Step-level account code modification is performed in the
USRSPGM exit.  This exit is invoked once for each step or
interval record for a job, task, session, or APPC/MVS TP.

Before invoking the USRSPGM exit, CA MICS saves the account
code (ACCTNOx) values set in the ACCTRTE.  You may change the
value of one or more ACCTNOx account codes in the USRSPGM
exit and the new values will be used for that particular
BATPGM, BAT_TS, BAT_ST, or BAT_TP observation.  Once the
step-level observation is written, CA MICS restores the
ACCTNOx values back to the original values set in ACCTRTE.

The job card account fields are read from the SMF initiation
or job termination records and stored in the ACTFLDx data
elements.  Most step-level accounting schemes rely on account
fields specified on the JCL EXEC statement for individual
steps.  In order to set step-level ACCTNOx values based on
these step-level account fields, you must make a modification
to CA MICS.

Note:  Implementation of any exit or modification should be
made through the CA MICS test database unit or test complex.
If you use the test complex, it must be at the same
maintenance level as your production complex.  Implement the
change, check the change thoroughly, and then move the change
to the production shared libraries.  This is a complex
modification.  If you have questions about the implementation
or effects of this complex modification, contact CA Technical
Support for assistance before you begin.

MODIFYING CA MICS TO READ AND SAVE STEP-LEVEL ACCOUNT FIELDS

To have account codes from the JCL EXEC statements of
individual steps available for the step-level ACCTNOx
setting, follow the five steps listed below:

1.  Update sharedprefix.MICS.GENLIB(SMFGENIN) to add the step
    accounting fields to the two step record suspension
    intermediate files, BATSFS and BATSFC.  The data element
    names used are SACTFLD1-5.  The addition is accomplished
    by adding data element descriptions for the new elements
    in these files in sharedprefix.MICS.GENLIB(SMFGENIN).

    Perform this step using the IEBUPDTE statements listed
    below.

    The FILE statements for the step suspend files are:

FILE SFS 02 1 Y N N N N N N N Step/Interval Record...15904000
FILE SFC 02 1 Y N N N N N N N Step Continuation Re...16404000

    Add a TYPE statement after the FILE statement, and add
    one NAME statement for each added data element as listed
    below.  Note that the 8-digit sequence numbers belong in
    columns 73-80:

    //xxx JOB (your job card)
    //STEP1 EXEC PGM=IEBUPDTE
    //SYSPRINT DD SYSOUT=A
    //SYSUT1 DD DISP=SHR,DSN=sharedprefix.MICS.GENLIB
    //SYSUT2 DD DISP=OLD,DSN=sharedprefix.MICS.GENLIB
    //SYSIN DD *
    ./ CHANGE NAME=SMFGENIN
    TYPE R $20 .  $20 .  $20 .                      01078100
    NAME SACTFLD1 00 0 N N N N Step Account Field 1 01078110
    NAME SACTFLD2 00 0 N N N N Step Account Field 2 01078120
    NAME SACTFLD3 00 0 N N N N Step Account Field 3 01078130
    NAME SACTFLD4 00 0 N N N N Step Account Field 4 01078140
    NAME SACTFLD5 00 0 N N N N Step Account Field 5 01078150
    TYPE R $20 .  $20 .  $20 .                      01200850
    NAME SACTFLD1 00 0 N N N N Step Account Field 1 01200860
    NAME SACTFLD2 00 0 N N N N Step Account Field 2 01200870
    NAME SACTFLD3 00 0 N N N N Step Account Field 3 01200880
    NAME SACTFLD4 00 0 N N N N Step Account Field 4 01200890
    NAME SACTFLD5 00 0 N N N N Step Account Field 5 01200900
    ./ ENDUP

2.  Regenerate the product by submitting the job in
    sharedprefix.MICS.CNTL(SMFCGEN).  This job will construct
    SMF support routines that include the data elements on
    the BATSFS and BATSFC files.

3.  Copy sharedprefix.MICS.SOURCE(#SMFEXIT) to the same named
    member of sharedprefix.MICS.TEST.SOURCE.

4.  Add the _USRSSFS macro code listed below to the _USRSSFS
    macro in sharedprefix.MICS.TEST.SOURCE(#SMFEXIT).  The
    modification links to ACCTBLD, and is inserted
    through the standard file manipulation exit (USRSSFS)
    for the Step Suspension (BATSFS) and the Step
    Continuation (BATSFC) files.

    The new code causes the extraction of account fields
    from SMF type 30 interval/step end records.

    ACCTBLD reads the SMF fields into data elements ACTFLD1-
    ACTFLD5.  The inserted logic must reassign these values
    into other data elements (SACTFLD1-5) so that the ACTFLD
    data elements will not overlay step values.

    MACRO _USRSSFS
    ...  (existing exit code, if any)
    * LOGIC TO PROCESS STEP ACCOUNTING INFORMATION;
    IF T30ACOFF AND T30ACSEG THEN DO;
      T30ACOFF = T30ACOFF - 3;
      COL = T30ACOFF;
      NUMACT = T30ACSEG;
    END;
    ELSE NUMACT = 0;
    IF NUMACT GT 0 THEN DO;
      LINK ACCTBLD;
      SACTFLD1 = ACTFLD1;
      SACTFLD2 = ACTFLD2;
      SACTFLD3 = ACTFLD3;
      SACTFLD4 = ACTFLD4;
      SACTFLD5 = ACTFLD5;
    END;
    ELSE DO;
      SACTFLD1 = ' ';
      SACTFLD2 = ' ';
      SACTFLD3 = ' ';
      SACTFLD4 = ' ';
      SACTFLD5 = ' ';
    END;
    ...
    %

OVERRIDING GLOBAL ACCTNOx VALUES FOR EACH STEP OR INTERVAL

To override ACCTNOx values set in the ACCTRTE, follow the
steps listed below:

1.  Modify the _USRSPGM macro code in #SMFEXIT to add logic
    to modify the account level data elements ACCTNO1 to
    ACCTNOx for the step-level files.  To do this, use the
    step accounting fields you have saved or any other step-
    level information that identifies ownership of the
    activity.  The SACTFLD1-5 data elements and any other
    step-level data elements contained in the BATPGM file are
    available.

    You may only want to set step-level account codes for a
    particular address space type, such as started tasks.
    You can use the data element PGMTYPE to determine the
    type of step record currently in process.

    PGMTYPE=1 - Batch
    PGMTYPE=2 - TSO Session
    PGMTYPE=3 - Started Task
    PGMTYPE=4 - APPC/MVS Transaction Program
    PGMTYPE=5 - Open Edition/MVS
    PGMTYPE=6 - System Address Space

    An example of a step-level accounting routine that only
    overrides the global account codes for started tasks is
    shown below.

    MACRO _USRSPGM
    ...  (existing exit code, if any)
    IF PGMTYPE = '3' THEN DO;
      IF SACTFLD1 NE ' ' THEN ACCTNO1=SACTFLD1 ;
      IF SACTFLD2 NE ' ' THEN ACCTNO2=SACTFLD2 ;
    ...  (logic appropriate to your purpose)
    END;
    ...
    %

    Note that the global ACCTNO3 account code is unchanged.
    Also, ACCTNO1 and ACCTNO2 are only overridden if step-
    level account codes (SACTFLDx) are non-blank, and the
    program type indicates a started task (PGMTYPE=3).

2.  Execute a CA MICS DAILY job on the test database unit.
    Provide test input data that has a variety of step
    records on the SMF log with different step account field
    contents.

3.  Examine the affected areas of the CA MICS test database
    completely.  For a good comparison, examine data from a
    similar run without the modification.  Make any
    corrections needed, and retest until the desired results
    are obtained.

4.  After testing is complete, move the SMF exit member to
    sharedprefix.MICS.SOURCE in your production complex.