7. PARAMETERS › 7.2 Complex Level Parameters › 7.2.3 Account Code Derivation Routine (DB2ACRT)
7.2.3 Account Code Derivation Routine (DB2ACRT)
After you have defined DB2ACCT for the number of account
codes to be carried in your DB2 files, code the Account Code
Derivation Routine (DB2ACRT) in sharedprefix.MICS.PARMS.
DB2ACRT is a SAS routine that derives the account code data
elements during the DAY065 step. For example, if you have
defined four account codes in DB2ACCT, then your DB2ACRT exit
must contain SAS code to derive the data elements DB2ACT1,
DB2ACT2, DB2ACT3, and DB2ACT4.
The DB2ACRT code is included directly into the DAY065 step.
If you modify the DB2ACRT code, the changes will take effect
during the next DAILY update run.
You are responsible for testing the accuracy of the exit
routine; however, the Analyzer provides a sample exit
routine. The worksheet for coding the DB2ACRT exit is shown
in Figure 7-2.
A sample DB2ACRT member is shown below:
/***********************************************************/
/* */
/* DB2ACT1 - Retain Auth. ID identifying requestor. */
/* */
/* DB2ACT2 - Retain transaction, "*BATCH*" or Correlation */
/* ID. Correlation ID for batch requests will contain */
/* JES job name so "*BATCH*" is used to group all batch */
/* interface requests. Retaining each unique batch job */
/* name in DB2ACT2 would increase the size of each */
/* CA MICS cycle of data. */
/* */
/* DB2ACT3 - Retain interface connection method used to */
/* access DB2. */
/* */
/* DB2ACT4 - Retain DB2 thread type. */
/* */
/* NOTE: This sample exit assumes that the VTAM APPLIDs */
/* assigned to CICS and IMS regions all begin with the */
/* characters "CIC" and "IMS" respectively. The SAS */
/* code must be changed if a different naming */
/* convention is used. */
/* Identify requesting user from Authorization ID */
DB2ACT1=DB2AUTH;
/* Identify requestor for specific Connection IDs */
SELECT(DB2CONN);
/* Identify batch interface as being used */
WHEN ('BATCH') DB2ACT2 = '*BATCH*';
WHEN ('UTILITY') DB2ACT2 = '*BATCH*';
WHEN ('DB2') DB2ACT2 = '*BATCH*';
WHEN ('DB2CALL') DB2ACT2 = '*BATCH*';
/* Identify requestor for all other Connection IDs */
OTHERWISE DO;
/* Retain the CICS trancode from the correlation ID */
IF DB2CONN =: 'CIC' THEN DB2ACT2 = SUBSTR(DB2CORR,5,4);
/* Retain the IMS PSBNAME from the correlation ID */
ELSE IF DB2CONN =: 'IMS' THEN DB2ACT2 = SUBSTR(DB2CORR,5,8);
/* Otherwise retain the entire correlation ID */
ELSE DB2ACT2 = DB2CORR;
END;
END;
/* Retain Connection ID for reference */
DB2ACT3=DB2CONN;
/* Retain Thread Type for DB2 remote (DDF) accesses */
DB2ACT4=DB2THDTY;
When CA MICS processes records that have Distributed Data
Facility (DDF) input, the DB2ACRT routine writes account code
values for the DB2 User DDF Activity (DB2DDU) file. In this
case, CA MICS reads the QMDAACCT field which provides the MVS
accounting string associated with the address space of an SQL
application. Multiple account codes are supplied in the
QMDAACCT field. CA MICS parses QMDAACCT so that these codes
can be available in up to nine work variables with names
DSUACTF1 through DSUACTF9. These work variables can be
referenced in the DB2ACRT when populating the DB2ACTn account
code elements for the DB2DDU file.
The multiple account fields for the SQL program can be seen
in the EXEC statement as follows:
//STEP1 EXEC PGM=progname,ACCT=(W,X,Y,Z)
In this case the account code strings W, X, Y, and Z will
appear in the QMDAACCT field which will populate work
variables DSUACTF1, DSUACTF2, DSUACTF3, and DSUACTF4. These
can be referenced in DB2ACRT by code that looks like this:
IF DB2THDTY GT 0 THEN DO:
DB2ACT1=DSUACTF1;
DB2ACT2=DSUACTF2;
DB2ACT3=DSUACTF3;
DB2ACT4=DSUACTF4;
END;
Using 'DB2THDTY GT 0' limits the input to the DDF cases.
+--------------------------------------------------------------------------+
| INSTALLATION PREPARATION WORKSHEET: DB2 Account Code Routine Definition |
| |
| PARMS Library Member is DB2ACRT |
+--------------------------------------------------------------------------+
| * VALIDATE ACCOUNT CODES |
| |
| IF { account data is valid } THEN DO; |
| |
| * POPULATE ACCOUNT CODE FIELDS |
| |
| DB2ACT1=field source 1 ; |
| DB2ACTn=field source n ; |
| ____________________________________________________________________ |
| ____________________________________________________________________ |
| ____________________________________________________________________ |
| ____________________________________________________________________ |
| ____________________________________________________________________ |
| END; |
| ELSE DO; |
| |
| * ASSIGN TO OVERHEAD ACCOUNT |
| |
| DB2ACT1='overhead category' ; |
| DB2ACTn='overhead category' ; |
| ____________________________________________________________________ |
| ____________________________________________________________________ |
| ____________________________________________________________________ |
| ____________________________________________________________________ |
| ____________________________________________________________________ |
| |
| END; |
+--------------------------------------------------------------------------+
Figure 7-2. DB2 Account Code Routine Definition Worksheet