BST08OCP: Archive copy batch utility

Overview

The BSA utility BST08OCP supports a different range of features depending on the Beta Systems product archive. The following tasks are supported for an Adabas Audit Data Retrieval archive:

  • Checking the contents of archive datasets (CHECK command)
  • Creating copies of archive datasets (COPY command)
  • Updating the database tables (AOR, IGR, IAR) according to the contents of the archive datasets (REPAIR command)
  • Reloading the lists and indexes contained in the archive datasets (RESTORE command)

License check

No license is necessary for the CHECK function. For all the other functions, the program verifies that the required license is present before it executes the specified function.

JCL

+--------------------------------------------------------------------+
|jobcard |
|//BST08OCP EXEC PGM=BST01RFF,REGION=0M,PARM=('S=97', |
|// 'PGM=BST08OCP', |
|// 'B01LST=xx', |
|// 'B97LST=xx', |
|// 'SIGNON=YES') |
|//* |
|//STEPLIB DD DISP=SHR,DSN=BETA97.LOAD |
|// DD DISP=SHR,DSN=BSA.LOAD |
|//* |
|//SFFPARM DD DISP=SHR,DSN=BETA.PARMLIB |
|//B97DEF DD DISP=SHR,DSN=BETA97.DB.DEF |
|//* |
|//IRMPRINT DD SYSOUT=* |
|//IRMLOG DD SYSOUT=* |
|//IRMERR DD SYSOUT=* |
|//IRMDEL DD SYSOUT=* |
|//IRMIN DD * |
| control statements |
|/* |
|//SYSPRINT DD SYSOUT=* |
|//SFFFDUMP DD SYSOUT=* |
|//SYSABEND DD SYSOUT=* |
+--------------------------------------------------------------------+

Return codes

0

The program terminated normally.

4

The program terminated with warnings, which can be caused by, for example:

  • No data was found to process.

8

Inconsistencies were found for at least one list.

16

This return code can occur due to several reasons:

  • An invalid keyword was coded.
  • A required DD statement was not coded.
  • The program was unable to find a matching record (AGR) for the dataset specified. (It is possible that the dataset has already expired or that the specified dataset name is wrong.)

DD names

DD name

Description

IRMPRINT

Used to log the program start, the command executed, and the result

IRMPROT

Contents of the archive datasets analyzed

This DD statement is required when using the CHECK command. It is optional for all other commands. Don't code this DD statement if you don't need this information.

IRMLOG

Used to log the control statements coded in DD IRMIN and to output messages

IRMERR

Contains lists where errors have been found (these lists are also logged in IRMPROT)

IRMDEL

List of datasets that are to be deleted; you can use DD IRMDEL as input for IDCAMS to delete these datasets

Is written when AGRs are deleted, e.g. when COPY uses a target subpool that already has datasets of the same archive run (same ATOKEN).

IRMIN

Control statements (see below under the descriptions of the functions CHECK, REPAIR, COPY, and RESTORE)

Instead of DD names with the prefix IRM, you can also use DD names with the prefix BST or BSS, i.e. BSTPRINT/BSSPRINT, BSTPROT/BSSPROT, etc.

Syntax for IRMIN

Keywords are separated by one or more blanks.

Specify a hyphen ( - ) at the end of the line if the statement continues on the next line.

Specify an asterisk ( * ) at the beginning of the line for comments.

CHECK function

CHECK analyzes the contents of the archive datasets that were created for an archive subpool during an archive run. The program checks which lists are contained in these datasets and the number of their indexes. It compares the number of pages at read-in and number of pages in the archive. The contents of the archive datasets are listed in DD IRMPROT.

The CHECK command supports the following subcommands:

DSNAME(dsname)

Name of any archive dataset that was created during the corresponding archive run

ORDER(n)

Order number of this dataset (reload order at the time of archival)

Example

CHECK DSNAME(B97.DISK01.E06032.C001) ORDER(1)

Notes

DSNAME(dsname) and ORDER(n) must be specified.
DD IRMPROT must be present.

Archive dataset selection

The program analyses all archive datasets of one subpool that were created during one archive run. ORDER(n) specifies the subpool. DSNAME specifies the name of one archive dataset. The program determines the other archive datasets of this archive run and their correct order on the basis of the Adabas Audit Data Retrieval database.

Background knowledge on database structure

Adabas Audit Data Retrieval administers archive datasets in the AGR table. The records of this table are displayed under option A.2.

The records of all archive datasets of one archive run share the same unique identifier (ATOKEN) in the database. The order number (reload order) specified in the archive subpool definition is stored in the AGRORDER field of this record. With the help of the values in the ATOKEN and AGRORDER fields, the program can identify all archive datasets that were created for one archive subpool during one archive run.

The program BST08OCP first identifies all datasets that belong to the same archive run and archive subpool as the archive dataset and order number specified as parameters (same values in the fields ATOKEN and AGRORDER). Subsequently, the program carries out the command.

REPAIR function

REPAIR carries out a check of the selected archive datasets (see CHECK) and creates or updates the corresponding data records in the specified database tables.

The REPAIR command supports the following subcommands:

DSNAME(dsname)

See CHECK

ORDER(n)

See CHECK

RECORD(AOR,IGR,IAR)

The corresponding records in the specified database tables are inserted or updated:

AOR

All data records with the identified ATOKEN plus AGRORDER are deleted and then new entries for the contents of the archive datasets are created.

IGR

A new IGR is inserted for each list in the processed archive dataset, which references this archive dataset. If an IGR is already present for a list, this record is preserved.

IAR

A new IAR is inserted for each index in the processed archive dataset, which references this archive dataset. If an IAR is already present for an index, this record is preserved.

Notes

DSNAME(dsname), ORDER(n) and RECORD(records) must be specified.

Example

REPAIR DSNAME(B97.DISK01.E06032.C001) ORDER(1) -
RECORD(AOR,IGR,IAR)

COPY function

COPY creates copies of the selected archive datasets (see CHECK). The source is specified using the subcommand FROM ORDER. You can specify one or more subpools as target using the subcommand TO ORDER. The program can copy archived datasets only within the same archive pool.

Archive subpool definitions must be present for the specified order numbers. You can create a new definition for the archive dataset copies or you can specify an archive subpool definition that already has archive datasets.

Archive datasets are not copied on a dataset-per-dataset basis. Instead, the number and size of the datasets created as copies depends on the target archive subpool definition. The last qualifier of an archive dataset copy is K001, K002, ..., Knnn. (K is the default. Code CHAR(x) if you want to use the specified character x instead.)

Important: When you copy archive datasets into a target archive subpool that already has archive datasets from the same archive run, the program deletes the corresponding database records from the database first before creating the archive dataset copies. The names of the datasets whose records are deleted are listed in DD IRMDEL. DD IRMDEL can be used as input of IDCAMS in order to delete these datasets.

The COPY command supports the following subcommands:

DSNAME(dsname)

See CHECK

FROM ORDER(n)

See CHECK, ORDER(n)

TO ORDER(n)

The archive dataset copies are assigned to this archive subpool. You can also specify more than one order number. Values are separated by commas.

CHAR(x)

K is the default for final qualifier Knnn of archive dataset copies. Code CHAR(x) if you want to use the specified character x instead.

If you copy to more than one target subpool (TO ORDER(n,n,n)), you can specify different characters for each copy (CHAR(x,x,x)).

EXPDT(date)

Determines the expiration date of the archive dataset copy. If EXPDT(date) is not coded, the archive dataset copies inherit the expiration date from the source datasets.

NOEXPIRED

The program does not copy lists whose archive expiration date has already been reached.

WHERE(bqlstatement)

The program copies only lists whose attributes match the specified WHERE condition. The WHERE condition refers to fields of the IGR and has to be specified using standard BQL syntax. (The use of WHERE automatically excludes expired lists because their IGRs are deleted after expiration.)

OUTSIDE

Specify OUTSIDE if you want to create archive dataset copies for an external location. In this case, the program does not create any records for archive administration in the current database (AORs and AGRs). The status of the AGRs of the source datasets is set to BAD.

Notes

DSNAME(dsname), FROM ORDER(n) and TO ORDER(n) must be specified. The other subcommands are optional.

Example

COPY DSNAME(B97.DISK01.E06032.C001) FROM ORDER(1) -
TO ORDER(95,96) EXPDT(31.12.2019)

COPY DSNAME(B97.DISK01.E06032.C001) FROM ORDER(1) -
TO ORDER(4) OUTSIDE -
WHERE(B97DATE EQ 20.03.2009 AND -
B97TIME EQ 12:39:16:07)

Moving archived lists with OUTSIDE

The COPY function can be used to move certain lists from an existing archive to other locations. In the following example, all lists whose extension begins with B31 are to be moved.

A first run creates archive dataset copies in a new subpool for the lists that are to remain in the data center. These copies contain all lists that are not to be moved. The program creates database records for archive administration (AORs and AGRs) and marks the AGRs of the source datasets as BAD.

COPY DSNAME(dsname) FROM ORDER(1) TO ORDER(3) -
WHERE(EXT UNLIKE B31*)

A second run creates the archive dataset copies for the lists that are to be moved.

COPY DSNAME(dsname) FROM ORDER(1) TO ORDER(4) -
OUTSIDE WHERE(EXT LIKE B31*)

RESTORE function

RESTORE reloads lists and their indexes from the selected archive datasets (see CHECK).

  • Lists are reloaded in the spool files of the type SPOOL; the corresponding data records of the type IGR are updated accordingly.
  • Indexes are reloaded in the spool files of the type INDEX; the corresponding data records of the type IAR are updated accordingly.

Only offline lists/indexes are reloaded (spool pointer and index pointer are zero). Lists must also be viewable (IGRVIEW = Yes).

Optionally, you can limit the selection of lists with a help of a WHERE condition.

The RESTORE command supports the following subcommands:

DSNAME(dsname)

See CHECK

ORDER(n)

See CHECK

RETPD

By default, the archive retention period for the reloaded lists and indexes is taken over as online retention period on a one-to-one basis. Enter the parameter RETPD, if the difference between list date (B97DATE) and date of the archive run should be added to the new online retention period.

Example: A list was read in on July 1, 2010, and archived on July 15, 2010, with a retention period of 365 days.
With RETPD: It expires on July 15, 2011.
Without RETPD: It expires on July 1, 2011.

WHERE(bqlstatement)

WHERE condition to limit the selection of lists for reloading (optional)

The WHERE condition refers to fields of the IGR and has to be specified using standard BQL syntax. (The use of WHERE automatically excludes expired lists because their IGRs are deleted after expiration.)

Notes

DSNAME(dsname) and ORDER(n) must be specified. The other subcommands are optional.

Example

RESTORE DSNAME(B97.DISK01.E06032.C001) ORDER(1) -
WHERE(ETOKEN EQ C1D4B3E8C50B31C0)

Example of IRMPROT

The contents of the analyzed datasets are listed in DD IRMPROT. The following information is printed for each archived list:

  • Form and extension
  • Jobname and JESID of the job that created this list
  • List date and time
  • ETOKEN
  • Number of pages (according to database)
  • Number of pages actually archived in the archive dataset (FOUND)
  • Number of indexes of this list (IDXCNT)
  • Return code (normally none; return code 8 indicates inconsistencies)

+---------------------------------------------------------------------------------------------------------------+
| FORM EXT REPORT JOBNAME JESID DATE TIME ETOKEN PAGES FOUND IDXCNT RC |
| ______________________________________________________________________________________________________________|
| |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:24:98 BC4294DFD911ED00 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:28:30 BC4294E303A7CA60 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:31:59 BC4294E627065180 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:34:81 BC4294E938F5BE00 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:38:13 BC4294EC63892380 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:41:42 BC4294EF86CBA0C0 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:44:62 BC4294F293F2DEE0 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:47:83 BC4294F5A4074F60 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:51:15 BC4294F8CE4A0900 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:54:42 BC4294FBEC9B1E60 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:00:57:64 BC4294FEFEB8C200 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:01:00:97 BC4295022C14E660 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:01:04:18 BC4295053B52E4E0 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:01:07:50 BC42950865DC4F00 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:01:10:73 BC42950B7A7D5F60 00000003 00000003 00002 |
| ARCH TAPE101 QIARC001 J0005679 13.12.2004 06:01:13:95 BC42950E8C9D92A0 00000003 00000003 00002 |
| |
| LISTS FOUND : 00000016 WITH RC : 000 |
+---------------------------------------------------------------------------------------------------------------+

Example: Using _beta report to create IRMIN

It is possible to use _beta report to generate the corresponding control statements for DD IRMIN. The following example shows how to create control statements for the copying of tape archive datasets. The statement IF TOKEN NE ATOKEN ensures that only one archive dataset is output for each archive run.

+-------------------------------------------------------------------+
|//BSTREPCP JOB CLASS=A,MSGCLASS=P,NOTIFY=&SYSUID |
|//* |
|//REPORT EXEC PGM=BST16RPG,REGION=0M |
|//STEPLIB DD DISP=SHR,DSN=BSA.LOAD |
|//RPGPARM DD * |
| SSID=ssid |
| TRACE=NO |
| DEBUG=NO |
| DATEMASK=DD/MM/YYYY |
| NUMBER=INTERNATIONAL |
|//* |
|//RPGPUNCH DD DSN=dsname,DISP=(,CATLG), |
|// SPACE=(CYL,(5,5),RLSE), |
|// DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200) |
|//RPGPRINT DD SYSOUT=* |
|//RPGSCAN DD SYSOUT=* |
|//RPGTRACE DD SYSOUT=* |
|//RPGSUM DD SYSOUT=* |
|//RPGWORK DD DSN=&&TEMP2,DISP=(,PASS),SPACE=(CYL,(5,5)) |
|//SORTOUT DD DSN=&&TEMP3,DISP=(,PASS),SPACE=(CYL,(5,5)) |
|//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(10,5)) |
|//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(10,5)) |
|//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(10,5)) |
|//SYSOUT DD SYSOUT=* |
|//SYSABEND DD SYSOUT=* |
|//RPGIN DD * |
| DEFCHAR TOKEN LENGTH 16 VALUE '0000000000000000' |
| DEFPCH PCH DDNAME 'RPGPUNCH' |
| MOVE 0 TO $BQLRC |
| WHILE $BQLRC EQ 0 |
| BQL_EXEC 'SELECT TABLE AGR FIELDS(*) - |
| WHERE (AGRORDER = 1 AND ARCHMED = TAPE) - |
| ORDER BY KEY AGRI00' |
| IF $BQLRC EQ 0 |
| IF TOKEN NE ATOKEN |
| MOVE ATOKEN TO TOKEN |
| PUNCH ' COPY DSNAME(' &AGRDSN ') - ' TO PCH |
| PUNCH ' FROM ORDER(' &AGRORDER ') TO ORDER(4) ' TO PCH |
| ENDIF |
| ENDIF |
| ENDWHILE |
| EXIT |
|/* |
+-------------------------------------------------------------------+