To use the accounting facility, you must first set up the operating system, then set up the job control statements for the accounting files.
When the VSE operating system is set up to use accounting, you need to set up a job control for the accounting files, within the job control that identifies your database. This job control must identify either one or two accounting files. It is recommended that you define two, so that you can use the alternate accounting file support.
If only one accounting file is used, you must shut down the database manager to process this file. With alternate accounting file support, you can switch from the current file to a second one while the database manager is running, which enables you to process the information in the first file without interrupting users. You can also use the alternate file support if there is a write error on the active file; or if you are accounting to DASD files, you can switch to the alternate file when the active file reaches the end of the extent.
If you switch to a second accounting file, you should process the closed file as soon as possible to prevent yourself from accidentally overlaying the previous session's accounting information.
The accounting files must be sequential files, and they can reside on either tape or DASD. If you define two, they must both be on the same storage medium: you cannot define one on tape and the other on DASD. If the files are on DASD, they can be native SAM files, VSE/VSAM ESDS files, or files managed by the VSE/VSAM space management for SAM feature. It is recommended that you define your accounting files on DASD as VSE/VSAM ESDS files.
Regardless of whether you use DASD or tape, you must specify the file name ARIACC1 for the first file on either the DLBL or TLBL statement. If you use two accounting files, the second file name must be ARIACC2. The database manager always opens ARIACC1 when it is started with the accounting facility active.
When the database manager ends (either normally or abnormally), it attempts to close the accounting file. If this file cannot be closed, accounting data may be lost.
To use DASD sequential files for your accounting data, first determine the potential size of the accounting data set. Initially, you should overestimate it; then adjust it based on your experience.
To get a general idea of how many accounting records are likely to be generated, start the application server for normal multiple user mode access, and at the end of the day, issue the COUNTER BEGINLUW and COUNTER CHKPOINT operator commands. The number of accounting records generated at your installation will be smaller than, but proportional to, these values. The database manager writes an accounting record for each user on some ends of logical units of work, and on all checkpoints. Three more accounting records are written for each run: one for startup, one for operation, and one for shutdown: you can ignore these three records when making your estimate.
For example, assume your counters show that your installation does 2000 logical units of work and 200 checkpoints a day. On average, this can result in 1000 accounting records generated for users and 200 records generated for checkpoints. For environments with heavy ISQL usage, the number of records generated for users would probably be lower, while for preplanned transaction environments, it would probably be higher, so you should overestimate the number of records needed.
To get an initial estimate for the size of your accounting files, multiply your estimate of the number of records by 80 to get the approximate number of bytes. For help in determining the file size that you need, see Storage Capacities of IBM DASD Devices.
When you have gained experience using accounting, you can adjust your file sizes.
If you have the VSE/VSAM space management for SAM (sequential access method) feature, you
should use it to manage your accounting files on DASD. This feature provides the following advantages:
The collisions must be resolved in the job control statements, as described on page 4.
Figure 75 shows sample job control statements for two accounting files managed by the VSE/VSAM space management for SAM feature.
Figure 75. Job Control for DASD Accounting Files (VSAM Space Management)
Notes:
If you run the database manager continually, it is advantageous to specify DISP=(NEW,KEEP) to have the accounting file erased every time it is opened. Here, you would be switching between the two accounting files, using the ALTACCT command, so that you can process the current file. If you specified DISP=(OLD,KEEP), the files would never be erased; they would keep growing. If you do specify DISP=(NEW,KEEP), be sure to process the accounting file immediately after you close it. If you do not, the accounting data will be erased the next time you switch accounting files.
Set RECSIZE to 80, because that is the size of an accounting record.
For RECORDS=(x,y), set x to the number of accounting records you expect to be generated during your accounting period. The value you specify for x is multiplied by 80 (the RECSIZE) by VSAM to determine the size of the primary space allocation. For example, if you have determined that you expect 500 accounting records to be generated for each accounting period, set x equal to 500. The number of bytes set by VSAM for the primary space allocation is 40000 (500 x 80). The value you specify for y determines the size of the secondary allocation. If you set y to 100, VSAM allocates 8000 bytes (100 x 80).
If the primary allocation is full, VSE/VSAM gets up to 15 additional extents. The VSAM catalog must own sufficient unallocated space on the specified volume to satisfy the space allocation requirements for the file.
Note: | If you use an explicit definition for the VSAM clusters, then specify a maximum record size of 2000 on the RECORDSIZE parameter of the IDCAMS utility DEFINE CLUSTER command. |
If you use native SAM, which cannot extend files, to manage accounting files on DASD, you must devise operating procedures to avoid overlaying the accounting information from the previous run of the database manager. This can be done by updating your job control EXTENT statements every time you start the application server, or by using two sets of job control with different EXTENT statements. When starting the application server, you would alternate between the two sets of job control statements.
If you use this approach, be certain to process the accounting file as soon as you close it; otherwise it will be overlaid the next time you start the application server by using the job control that identifies the file. If you load your accounting data into tables, consider prefixing your normal start-up job control with a DBS utility job that runs in single user mode (with ACCOUNT=N specified). This job would run the DBS utility to load accounting data from the previous session into tables to prevent it from being overlaid by the next job.
Figure 76 shows sample job control statements for native SAM accounting files.
Figure 76. Job Control for DASD Accounting Files (Native SAM)
// DLBL ARIACC1,'ACCTFIL1' // EXTENT ,SQLWK1,1,0,57,38 // DLBL ARIACC2,'ACCTFIL2' // EXTENT ,SQLWK1,1,0,95,30 // ASSGN SYS007,DISK,VOL=SQLWK1,SHR |
Notes:
Even if you are using alternate accounting files, you would have to change the extents unless you ensure that the accounting data from the previous run is processed before it is overlaid.
It is recommended that you define your accounting files on DASD as VSE/VSAM ESDS files because they handle the End-of-Extent situation better than VSE/VSAM managed by SAM files. All advantages of using VSE/VSAM files still remain for VSE/VSAM ESDS files, except that the files will have to be defined explicitly. Figure 77 shows sample IDCAMS commands to define two VSE/VSAM ESDS accounting files. See Converting VSAM ESDS Accounting File Records into VSAM Managed SAM Feature Records for related consideration of loading the accounting records using VSE/VSAM ESDS accounting files.
Figure 77. IDCAMS Commands to Define VSE/VSAM ESDS DASD Accounting Files
// EXEC IDCAMS,SIZE=AUTO DEFINE CLUSTER (NAME(ACCTFIL1) - VOLUMES(SQLWK1) - ORDERED - REUSE - RECORDS(x y) - RECORDSIZE(80 80) - NOINDEXED) - DATA(NAME(ACCT.FILE1.DATA)) DEFINE CLUSTER (NAME(ACCTFIL2) - VOLUMES(SQLWK1) - ORDERED - REUSE - RECORDS(x y) - RECORDSIZE(80 80) - NOINDEXED) - DATA(NAME(ACCT.FILE2.DATA)) /* |
Note: |
|
Figure 78 shows sample job control statements for two VSE/VSAM ESDS accounting files.
Figure 78. Job Control for DASD Accounting Files (VSE/VSAM ESDS)
// DLBL ARIACC1,'ACCTFIL1',0,VSAM, C CAT=SQLWK1,DISP=(OLD,KEEP) // DLBL ARIACC2,'ACCTFIL2',0,VSAM, C CAT=SQLWK1,DISP=(OLD,KEEP) |
Note: |
|
To write accounting records to a tape file, specify a TLBL statement in your database job control. The file name on the TLBL statement must be ARIACC1. If you will be using alternate accounting files, specify a TLBL statement for a second accounting file, and call the file ARIACC2.
When accounting to tape, the database manager uses the VSE dynamic tape ASSIGN macro. The operator is prompted for the address (cuu) of the tape drive.
If you switch the output to the alternate file, the cuu of the first accounting file is unassigned by the VSE dynamic tape ASSIGN macro, and becomes available for use for any purpose, including reuse for the alternate file. Figure 79 shows an example of job control statements for two accounting files.
Figure 79. Example Job Control for Accounting Files on Tape
// TLBL ARIACC1,'ACCTFIL1' // TLBL ARIACC2,'ACCTFIL2' |
To avoid overlaying accounting information from the previous session, the database manager does not rewind the accounting tape at OPEN or CLOSE time. Therefore, when the application server is next started, another accounting file is written starting after the file from the previous session.
A block size of 2000 is used for the tape file. This provides efficient performance, and minimizes the amount of accounting data lost due to a system failure or a write error on the tape.
While it is unlikely that you will reach end-of-volume for a tape accounting file, multivolume tape support is provided. You must use only IBM standard label tape files.