Usage Accounting Exit: UACCT

In this section:

The distributed copy of FOCUS contains a dummy version of the UACCT exit routine. To activate a live version, a small interface routine and the user code must be link edited into FOCUS. The user code can be written in any language or mixture of languages, and can issue all system macros except STAI and STAX. It is entered through a standard IBM CALL macro, at entry point UACCT. Since this code becomes an integral part of the FOCUS code, you must avoid name conflicts with FOCUS routines, and it is suggested that all user-written programs start with the letters UA.

Note that z/OS-compatible versions of user exits are required since the user-exit code resides within the FOCUS load module.


Top of page

x
UACCT Calling Sequence

The UACCT exit is called at different times for different purposes, but the calling sequence is always the same. The first argument indicates the type of call being made. For example, in COBOL the UACCT calling sequence is:

ENTRY UACCT USING CALLTYPE ATCB BILLCODE
    COMMAND FILE LINENO PROCEDURE STATS UACVT

All arguments are input arguments and must not be modified by the called program, except as noted in External Security Violations.

CALLTYPE

4-byte binary integer

 

-1

Initialization call, made at start of job or session.

-2

Wrap-up call, made at end of job or session.

0

Usage statistics call, made following the completion of most FOCUS commands.

1

DBA violation call, made as detected.

2

FOCUS starting processing call, made after parsing but before data access.

ATCB

4-byte address of the FOCUS task control block. The TSO userid or batch job name and various other items can be obtained from this standard IBM control block.

The ATCB parameter is present in all calls. The remaining arguments are also present but meaningful only when the CALLTYPE is 0, 1 or 2.

BILLCODE

8 characters

FOCUS billing code, set by the FOCUS command SET BILLCODE=value. This argument is included to enable accounting distinctions within a user ID.

COMMAND

8 characters

Name of FOCUS command to which the exit call applies.

FILE

8 characters

Name of the FOCUS data source.

LINENO

4-byte binary integer

The current FOCEXEC procedure line number.

PROCEDURE

8 characters

The name of the FOCEXEC containing the command that triggers the call to the Usage Accounting exit. Dialogue Manager commands and comment lines do not trigger calls to Usage Accounting. If the command that triggers the call is terminal input, PROCEDURE will be blank.

STATS

17 fullword binary integers

Contains either usage statistics or DBA violation data. Ignore this if the call signals the start of processing (CALLTYPE = 2).

UACVT

Not currently in use.



x
Usage Statistics Calls (CALLTYPE=0)

The UACCT exit is called with CALLTYPE=0 for the following FOCUS commands:

TABLE*
TABLEF*
MODIFY*
GRAPH*
SCAN*
MATCH
HOLD
SAVE
SAVB
ANALYSE
REBUILD
CMS/TSO
CREATE
RETYPE
REPLOT

Commands designated with an asterisk (*) also generate a starting-processing call to UACCT (CALLTYPE=2).

When CALLTYPE is 0 the 17 STATS words contain information that can be displayed by issuing the ? STATS command. These statistics are also posted as Dialogue Manager parameters, under the &name shown. All statistics are per command, not cumulative for the FOCUS session.

STATS(1)

&RETCODE

FOCUS return code posted by the command (not the return code posted when FOCUS exits). Zero indicates that the command executed successfully.

STATS(2)

&RECORDS

The number of records retrieved by a TABLE, TABLEF or GRAPH command. When more than one segment is referenced by the command, a record is a path in the referenced subtree.

STATS(3)

&LINES

The number of lines created by the report, or the number of records SAVED or HELD, before application of any IF TOTAL tests.

STATS(4)

Reserved.

STATS(5)

&BASEIO

The number of 4096 byte pages read or written in the FOCUS data source. This value will be zero for non-FOCUS data sources.

STATS(6)

The number of reads issued when reporting from a non-FOCUS data source. The value will be zero for FOCUS data sources. Each read is a QSAM GET, ISAM GET, or one call to the interface module, as the case may be. In the case of data adapters, such as the IMS/DB, IDMS, TOTAL, ADABAS, and FOCSAM interfaces, each call produces one instance of one segment.

STATS(7) to STATS(16) are statistics posted by the MODIFY and the SCAN commands. These statistics will have the value zero for all other commands.

STATS(7)

&TRANS

STATS(8)

&ACCEPTS

STATS(9)

&INPUT

STATS(10)

&CHANGED

STATS(11)

&DELETED

STATS(12)

&NOMATCH

STATS(13)

&DUPLS

STATS(14)

&FORMAT

STATS(15)

&INVALID

STATS(16)

&REJECTS

STATS(17)

&SORTIO - The number of reads and writes to the FOCSORT scratch file. Zero indicates that the sort phase of the report is executed entirely in memory.

Note: FOCUS data sources and the FOCSORT scratch file are BDAM data sets and as such must be formatted before they can be used. Formatting occurs when the CREATE command is issued or when the FOCUS data source is extended, as in the course of a MODIFY command; FOCSORT is formatted by the first write into it. The formatting I/O activity is not included in the &BASEIO or in the &SORTIO statistics.



x
DBA Violation Calls (CALLTYPE=1)

Execution-time DBA violations arising from insufficient access rights generate one of several FOCUS error messages, depending on the nature of the violation, and the accounting exit routine is called with CALLTYPE=1 to log this event. The call to log the violation occurs before the corresponding error message is displayed (for example, before the user is made aware that the violation was detected). All the calling arguments are as documented previously, except the STATS area, which in lieu of statistics contains the following items:

STAT(1)

4 byte binary integer

The FOCUS error message number (for example, 47, 56).

STAT(2)

4-byte binary integer

The length, in bytes, of the variable portion of the error message.

STAT(3)

A character string of the length indicated by STAT(2), the variable portion of the error message. This will be the FOCUS data source name or field name to which the message refers.

The possible error messages follow. The variable portion of the message is shown in brackets.

(FOC047) USER DOES NOT HAVE SUFFICIENT ACCESS RIGHTS TO FILE:<file>
(FOC052) USER DOES NOT HAVE SUFFICIENT ACCESS RIGHTS TO FIELD:<fieldname>
(FOC054) FILE PROTECTED BY DIFFERENT DBA:<file>
(FOC056) USER ACCESS RIGHTS DO NOT ALLOW INCLUDE OR DELETE:<file>

Error messages 54 and 56 can occur only with FOCUS data sources, but 47 and 52 can occur in any FOCUS readable file protected by the DBA feature.



x
Start of Processing Calls (CALLTYPE=2)

These exit calls are made following the parsing and verification of the retrieval commands (TABLE, TABLEF, GRAPH, MATCH) and of the SCAN and MODIFY commands, but before any attempt is made to access the data. For retrieval commands the start of the processing call is made for all types of data—sequential and VSAM files, IMS data sources, FOCUS data sources—and, in the case of VSAM and QSAM files, before they are opened. The CALLTYPE is 2 and all other arguments are exactly the same as for the Usage Statistics call that will follow, except that the STATS argument is not available.


Top of page

x
External Security Violations

The UACCT exit routine can perform any type of accounting or logging activity and it can also interrogate external security systems such as RACF or ACF2 to determine if the current FOCUS command is dealing with secured files or data sets. If a security violation is detected, UACCT can terminate FOCUS gracefully by changing the input COMMAND argument to 8 bytes of binary zeroes. In this event FOCUS will issue the following diagnostic message and return to the operating system with a return code of 8:

(FOC999) FOCUS TERMINATED BY USER EXIT ROUTINE UACCT

The COMMAND argument is the only modifiable argument in the UACCT calling sequence; all other arguments must be left as they were.

FOCUS can be terminated in this way in all UACCT calls in which CALLTYPE is 0, 1 or 2, but the most logical time to do so is in a type 2 call after all the parsing has been done and before any data access is attempted. In TSO, the ATCB argument points to the FOCUS task control block, which points at the userid or job name, and the FILE argument is the FOCUS name of the data source to be accessed. In the case of QSAM and VSAM files, it is the ddname to which the data set was allocated, and the dsname can easily be obtained using a RDJFCB macro. In the case of FOCUS data sources it is also the ddname to which the data source has been allocated, except when the logical data source is spread over several data sets, allocated under different ddnames. In the case of IMS or IDMS data sources there is no connection between this FOCUS file name and the physical data sets to be accessed, and the FOCUS file name corresponds to a logical view of these data sources—a PCB in the case of IMS, a subschema for IDMS.


Top of page

x
UACCT Installation

The following listing shows how to link edit the UACCT exit routine into FOCUS. In this example, COBOL user code (in object form) is allocated to ddname USERCODE and is brought in with the INCLUDE USERCODE statement. Any other routines called should also have INCLUDE statements code before the INCLUDE MAINTAIN (UAINT) statement.

//LINK1  EXEC PGM=IEWL,PARM='LET,NCAL,LIST,MAP,SIZE=1024K'
//SYSLMOD...DD  DISP=OLD,DSN=prefix.FOCLIB.LOAD <-- FOCUS load library
//MAINTAIN..DD  DISP=SHR,DSN=prefix.FOCCTL.DATA <-- Maintenance library
//UACCT  ...DD  DISP=SHR,DSN=prefix.user.code   <-- Compiled UACCT code
//SYSUT1 ...DD  UNIT=SYSDA,SPACE=(CYL,(5,5))
//SYSPRINT..DD  SYSOUT=*
//SYSLIN  ..DD  *
  INCLUDE UACCT        .....<-- UACCT and any programs it calls
  INCLUDE MAINTAIN(UAINT)  .<-- Real exit-calling routine
  REPLACE CHARGE        ....<-- Use the new exit-calling routine
  INCLUDE SYSLMOD(CORFOC)   <-- FOCUS itself
  INCLUDE MAINTAIN(CORFOC)  <-- Linkage editor control cards
  NAME  FOCUS(R)       .....<-- Output module
/*

The last three INCLUDE statements must execute in the order shown. The UAINT member of the FOCCTL.DATA PDS replaces the dummy UACCT interface shipped in the distributed version of FOCUS.


Information Builders