SARDBASE Examples

The following examples demonstrate the facilities available with SARDBASE database maintenance.
view
The following examples demonstrate the facilities available with SARDBASE database maintenance.
Contents
Example 1 Creating a Database
In this example, a new database is created with a high-level name of VIEW.SYSTEM1. The number of cylinders allocated are 10 for index and 50 for the data. The index and data portions are allocated on different volumes, SAR001 and SAR002, for improved performance.
//EXAMPLE1 JOB ACCOUNT,PROGRAMMER //STEP1    EXEC PGM=SARDBASE //STEPLIB  DD DSN=CAI.CVDELOAD,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN    DD * NAME VIEW.SYSTEM1 ADDDS UNIT=3390 VOL=SAR001 CYL=10 INDEX ADDDS UNIT=3390 VOL=SAR002 CYL=50 DATA /*
Example 2 Adding Space
In this example, the database defined in the previous example is out of space and an additional 100 cylinders are added to the database on unit 3390 volume SAR002. The STATUS parameter displays statistics about the database after the addition of the space.
//EXAMPLE2 JOB ACCOUNT,PROGRAMMER //STEP1    EXEC PGM=SARDBASE //STEPLIB  DD DSN=CAI.CVDELOAD,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN    DD * NAME VIEW.SYSTEM1 ADDDS UNIT=3390 VOL=SAR002 CYL=100 DATA STATUS /*
Example 3 Changing Online Members
In this example, changes that were made to the online library, pointed to by the SAROLIB DD, are reloaded to the VIEW.SYSTEM1 database.
//EXAMPLE3 JOB ACCOUNT,PROGRAMMER //STEP1    EXEC PGM=SARDBASE,PARM='VIEW.SYSTEM1' //STEPLIB  DD DSN=CAI.CVDELOAD,DISP=SHR //SAROLIB  DD DSN=CAI.CVDEPENU,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN    DD * OLOAD /*
Example 4 Copying a Database
In this example, database VIEW.SYSTEM1 continually grows in size with the addition of many data sets. For performance reasons, it is copied to a new large database. The old database retains the name of VIEW.OLDSYS1.
  //EXAMPLE4 JOB ACCOUNT,PROGRAMMER //STEP1 EXEC PGM=SARDBASE //STEPLIB DD DSN=CAI.CVDELOAD,DISP=SHR //SYSPRINT DD SYSOUT=* //SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(50)) //SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(50)) //SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(50)) //SYSIN DD * NAME VIEW.SYSTEM1 RENAME VIEW.OLDSYS1 NAME VIEW.SYSTEM1 ADDDS UNIT=3380 VOL=SAR001 CYL=50 INDEX ADDDS UNIT=3380 VOL=SAR002 CYL=600 DATA COPY VIEW.OLDSYS1 /*
Example 5 Deleting a Database
In this example, database VIEW.OLDSYS1 is no longer being used and is deleted.
//EXAMPLE5 JOB ACCOUNT,PROGRAMMER //STEP1    EXEC PGM=SARDBASE //STEPLIB  DD DSN=CAI.CVDELOAD,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN    DD * NAME VIEW.OLDSYS1 DELETE /*
Example 6 Sequential Copy of the Index
In this example, a sequential copy of the master index for database VIEW.SYSTEM1 is printed.
//EXAMPLE6 JOB ACCOUNT,PROGRAMMER //STEP1    EXEC PGM=SARDBASE //STEPLIB  DD DSN=CAI.CVDELOAD,DISP=SHR //SYSPRINT DD SYSOUT=* //SARIOUT  DD DSN=USER.DATA SET,DISP=(,CATLG), //            UNIT=SYSDA,SPACE=(CYL,(1,1)) //SYSIN    DD * NAME VIEW.SYSTEM1 IDXOUT /*
Example 7 Restore
In this example, the database is restored from the most recent backup, as indicated in the recovery data set maintained by SARSTC. The old database is named VIEW.SYSTEM1 and a new database named VIEW.NEWSYS1 is created. The following job recovers the database:
//RESTORE  JOB ACCOUNT,PROGRAMMER //STEP1    EXEC PGM=SARDBASE //STEPLIB  DD  DSN=CAI.CVDELOAD,DISP=SHR //SYSPRINT DD  SYSOUT=* //SARRECV  DD  DSN=VIEW.SARRECV,DISP=SHR //SYSIN    DD  * NAME VIEW.NEWSYS1 ADDDS UNIT=3390 VOL=SAR001 CYL=85 INDEX ADDDS UNIT=3390 VOL=SAR001 CYL=600 DATA RESTORE VIEW.SYSTEM1 /*
Example 8a Tape Map/Restore (Tape Map)
In this example, the database is recovered from the most recent backup and the recovery data set is not available. The old database is named VIEW.SYSTEM1 and a new database named VIEW.NEWSYS1 is created. When the recovery data set is not available to identify the most recent backup, SARTCP must be run. SARTCP maps the current archival tape to locate the position of the master index backup.
The following job maps the archival tape:
//TAPEMAP  JOB ACCOUNT,PROGRAMMER //STEP1    EXEC PGM=SARTCP //STEPLIB  DD  DSN=CAI.CVDELOAD,DISP=SHR //SYSPRINT DD  SYSOUT=* //TAPEIN   DD  DSN=VIEW.SYSTEM1.SARTAPE.T0000156, //             DISP=OLD //SYSIN    DD  DUMMY
Example 8b Tape Map/Restore (Restore)
Assume the map of the archival tape shows master index backups in positions 50 and 1370 of the tape. This means position 1370 contains the most recent backup. You can use the following JCL to restore the most recent backup.
Note:
This example does not support a master index that spans two reels. If you have a master index that spans two reels, a RESTORE with SARRECV DD statement is the recommended method.
The following job is executed to restore the database:
//RESTORE  JOB ACCOUNT,PROGRAMMER //STEP1    EXEC PGM=SARDBASE //STEPLIB  DD  DSN=CAI.CVDELOAD,DISP=SHR //SYSPRINT DD  SYSOUT=* //SARTAPE  DD  DSN=VIEW.SYSTEM1.SARTAPE.T0000156, //             DISP=OLD,LABEL=1370 //SYSIN    DD  * NAME VIEW.NEWSYS1 ADDDS UNIT=3390 VOL=SAR001 CYL=85 INDEX ADDDS UNIT=3390 VOL=SAR001 CYL=600 DATA RESTORE VIEW.SYSTEM1 /*
Example 9 Sequential Copy of the Entire Database
In this example, the database is unloaded for backup purposes. The unloaded backup is a sequential data set on tape.
The following job unloads the database:
//UNLOAD   JOB ACCOUNT,PROGRAMMER //STEP1    EXEC PGM=SARDBASE //STEPLIB  DD  DSN=CAI.CVDELOAD,DISP=SHR //SYSPRINT DD  SYSOUT=* //SARUNLD  DD  DSN=VIEW.UNLOAD,DISP=NEW, //         UNIT=TAPE,DCB=(RECFM=VB, //         LRECL=32756,BLKSIZE=32760) //SYSIN    DD  * NAME VIEW.SYSTEM1 UNLOAD /*
Example 10 Recover Unloaded Backup
In this example, the database is recovered from a previous, unloaded backup (see the previous example). The STATUS command causes statistics on the database following the load to be displayed.
The following job reloads the database:
//LOAD JOB ACCOUNT,PROGRAMMER //STEP1 EXEC PGM=SARDBASE,PARM='VIEW.SYSTEM1' //STEPLIB DD DSN=CAI.CVDELOAD,DISP=SHR //SYSPRINT DD SYSOUT=* //SARLOAD DD DSN=VIEW.UNLOAD,DISP=OLD, // UNIT=TAPE,DCB=(RECFM=VB, // LRECL=32756,BLKSIZE=32760) //SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(50)) //SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(50)) //SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(50)) //SYSIN DD * LOAD STATUS /*