Sample Archiving Setup

Assume that you have the following requirements for archiving:

  • Statistics records must remain available for seven days in the file pair list before being overwritten by new records. After seven days, they must be available in archive files.
  • Each archive file can contain no more than one day of statistics records.
  • Batch jobs executing the IDCAMS utility to copy the records to sequential files on magnetic tape must perform the archiving. The archive files must be available for 365 days.
  • Maintain a directory of archive files.
  • Ensure that statistics data is not overwritten before being archived.
  • Establish a procedure for making archived statistics available to the SELECT STATISTICS command.

Sample Statistics Configuration

This section describes how to configure the statistics facility to satisfy these requirements.

You must determine how to configure the statistics file pair list. The rate at which you log statistics records, availability of the statistics records for seven days before being overwritten, and each archive file containing no more than one day of statistics records determine the size and number of file pairs required.

For the statistics records to remain available for seven days after being generated, the total record capacity of all the entry-sequenced statistics files is seven times the average number of records generated daily. Run the DGASSTAT utility to determine how many records, on average, the system writes daily.

According to the sample requirements, a single archive file contains up to the same number of records as a single statistics entry-sequenced cluster, and an archive file contains no more than a day of records. Each ESDS also holds about a day of records, implying that seven statistics file pairs exist. Use the STAT.SWITCH.TIME initialization parameter to initiate a file pair switch every day at midnight rather than depend on a file pair switch occurring regularly as a result of file pairs filling. To ensure that the switches do not occur before midnight as a result of a file pair becoming full, make each ESDS slightly larger than the daily requirement.

If you determine, using DGASSTAT, that the system writes statistics records at the rate of about 11,000 daily, define seven file pairs each with a capacity of about 12,000 records (RECORDS(12000)). This figure implies that the associated key-sequenced clusters are defined with RECORDS(9000).

RECORDS(365) defines the directory of archive files because the system generates the archive files at the rate of one daily and retains the files for one year.

SYSTEMS.CD.STATS is the data set name prefix for the statistics clusters. The data set name of the archive directory is SYSTEMS.CD.STATS.DIRECTRY. Member ARCHPROC in the data set SYSTEMS.CD.ADMINLIB contains the archive Process that is submitted at file pair switch time.

The following initialization parameters are necessary for the sample archive requirements.

STAT.DSNBASE = SYSTEMS.CD.STATS     /*  data set name base         */
STAT.FILE.PAIRS = 7                 /*  number of file pairs       */
STAT.SWITCH.TIME = ( 00:00 )        /*  switch at midnight         */
STAT.SWITCH.SUBMIT = SYSTEMS.CD.ADMINLIB(ARCHPROC) /* archive proc */
STAT.ARCH.DIR = SYSTEMS.CD.STATS.DIRECTRY  /* use directory        */
STAT.ARCH.CONFIRM = YES             /*  be sure archive completes  */

The archive Process in the member ARCHPROC follows.

ARCHIVE PROCESS  &EDSN=,              -  /* passed stats dsname    */
                 SNODE=CD.PROD,       -  /* PNODE=SNODE            */
                 PNODE=CD.PROD,       -  /*                        */
                 CLASS=1,             -  /* lowest class           */
                 PRTY=15,             -  /* highest priority       */
                 REQUEUE=YES             /* re-queue on error      */
  /*                                                               */
  /*  invoke DGADTSUB to submit the archive job...                  */
  /*                                                               */
       RUN TASK (PGM=DGADTSUB,           -  /* execute DGADTSUB,     */
 PARM=("DSN=SYSTEMS.CD.JCL(ARCHJOB),DISP=SHR", - /*job   */
  /* stream to sub*/
            "DSNAME  &EDSN"))             /* pass stat dsname      */

The archive job stream in SYSTEMS.CD.JCL(ARCHJOB) follows.

//ARCHJOB JOB (ACCT),ARCHIVE,CLASS=A,MSGCLASS=Z,MSGLEVEL=(1,1)
//******* archive the statistical data  ****************************
//ARCHIVE EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INPUT    DD DISP=SHR,CD=&DSNAME             /* from DGADTSUB      */
//OUTPUT   DD DSN=SYS.NDM.ARCH.STATS(+1),DISP=(NEW,CATLG,DELETE),
//            UNIT=TAPE,DCB=(BUFNO=6)
//SYSIN    DD *
  REPRO INFILE(INPUT) OUTFILE(OUTPUT)
/*
//******* notify Connect:Direct that the file pair can be reused, ****
//******* and update the directory of archive files    *************
//NOTIFY  EXEC PGM=DGADARBT,COND=(0,LT)            /* if no errors      */
//STEPLIB  DD DISP=SHR,DSN=SYS.CD.SDGALINK
//STESDS DD DISP=SHR,DSN=*.ARCHIVE.INPUT           /* stat file         */
//STDIR  DD DISP=SHR,DSN=SYSTEMS.CD.STATS.DIRECTRY /* archive directory */
//STARCH DD DISP=SHR,DSN=*.ARCHIVE.OUTPUT          /* archive file      */
//SYSOUT DD SYSOUT=*
//

The previous archive job stream indicates that the IBM® Connect:Direct® administrator manages requests for access to archived statistics records. The submitted requests specify a range of dates and times for the necessary records.

The administrator issues the INQUIRE STATDIR command to determine which archive files contain records for the specified period. The administrator runs the following job stream to create a usable archived statistics file pair for each archive file that it finds. The first step creates the archive file and copies the record to it. The second step builds the index information.

//RESTORE JOB (ACCT),RESTORE,CLASS=A,MSGCLASS=Z,MSGLEVEL=(1,1)
//ARCHIVE EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INPUT    DD DISP=SHR,DSN=SYS.CD.ARCH.STATS.GnnnnVnn  /* arch seq  */
//SYSIN    DD *
   DEFINE CLUSTER                            - /* define archive KSDS       */
     (NAME(SYS.CDARCH.Dyymmdd.KSDS)          - /* supply archive date yymmdd */
      VOLUMES(USRVOL)                        -
      INDEXED   NOIMBED                      -
      FREESPACE(0 0)                         -
      KEYS(27 0)                             -
      RECORDSIZE(32 78)                      -
      REUSE NOREPLICATE                      -
      SHAREOPTIONS(2))                       -
     DATA                                    -
      (CONTROLINTERVALSIZE(4096)             -
       RECORDS(9000)                         -
       NAME(SYS.CDARCH.Dyymmdd.KSDS.DATA))   -
     INDEX                                   -
      (CONTROLINTERVALSIZE(512)              -
       NAME(SYS.CDARCH.Dyymmdd.KSDS.INDEX))
   DEFINE CLUSTER                            - /* define archive ESDS */
     (NAME(SYS.CDARCH.Dyymmdd.ESDS)          -
      VOLUMES(USRVOL)                        -
      REUSE NONINDEXED NOIMBED               -
      RECORDS(12000)                         -  /* same size as stats files */
      RECORDSIZE(275 2048)                   -
      SHAREOPTIONS(2))                       -
     DATA                                    -
      (CONTROLINTERVALSIZE(4096)             -
NAME(SYS.CDARCH.Dyymmdd.ESDS.DATA))
   IF MAXCC = 0                              -  /* if clusters allocated OK */
   THEN REPRO INFILE(INPUT)                  -  /* then load with stats     */
        OUTDATASET(SYS.CDARCH.Dyymmdd.ESDS)
/*
//*******
//******* rebuild statistics index information
//*******
//BLDKEY  EXEC PGM=DGADBKEY,COND=(0,LT)
//STEPLIB  DD DISP=SHR,DSN=SYS.CD.NDMLIB
//SYSOUT   DD  SYSOUT=*
//ESDSnn   DD DISP=SHR,DSN=SYS.CDARCH.Dyymmdd.ESDS  /* ESDS cluster */
//KSDSnn   DD DISP=SHR,DSN=SYS.CDARCH.Dyymmdd       /* KSDS cluster */
//

The archived statistics are now available and you can issue SELECT STATISTICS against the statistics by coding the name of the key-sequenced file with the ARCHDSN parameter, as follows.

SELECT STATISTICS WHERE  -
                (PNAME=USERPROC, ARCHDSN=(SYS.CDARCH.Dyymmdd))