Tailoring the Operational Assistant Backup Exit

Marc Vadeboncoeur, iTech Solutions

I was recently at a customer site in Texas installing a brand new POWER9 system, and along with their beautiful new P9 box, I also installed a new IBM tape library device to replace an older standalone single cartridge tape unit that they had been using to back up their old POWER6 system.

The customer utilizes the IBM i native (built-in) RUNBCKUP command provided by IBM’s longtime Operational Assistant facility (GO ASSIST) to perform their daily and weekly backups. They wanted to take advantage of the multi-cartridge magazine capacity and autoloader feature of their new IBM tape library to be able to load a bunch of cartridges at the beginning of every week and simply have the tape library load a new tape out of its magazine inventory after the completion of each backup. That way there would always be a new tape in the drive ready-to-go with no daily manual loading required. Pretty standard stuff.

The problem encountered with making the tape autoloading work was that the hard-wiring in the venerable RUNBCKUP command will not do an automatic ENDOPT(*UNLOAD) at the end of a *DAILY, *WEEKLY, or *MONTHLY backup operation.  If you are using a tape library with the autoloader feature enabled and you perform a backup with the RUNBCKUP command the default is for the tape to simply rewind after the RUNBCKUP command has completed, there is no setting in the RUNBCKUP or CHGBCKUP commands to specify that you want the tape to unload after it rewinds upon backup completion, which kind of makes having an autoloading tape library useless if you want to have the next tape for the next backup automatically loaded every day.  Well, there is a solution, and the solution is… an exit program!

IBM provides the capability to specify a customer-written exit program on the CHGBCKUP command (screenshot below), and the key to understanding it is knowing that the same exit program gets called twice on every RUNBCKUP command execution. It gets called right before the backup operation starts, and then again right after the backup operation ends.  Say you wanted to bring down a particular subsystem every night right before the daily backup starts to prevent any possible object locks, you would simply write an exit program CLP that would do an ENDSBS command when the exit program is being called before the backup starts.  Now, say you were also presented with the scenario that I described above where you just got a shiny new autoloading tape library device and you want to force the tape to unload at the end of every backup so the tape for the next day’s backup would automatically be loaded?  Then you would have your exit program CLP simply do a CHKTAP ENDOPT(*UNLOAD) command when the exit program is being called after the backup completes.

Please examine the code below for a sample Control Language program (CLP) that you can copy & paste and use in your own environment.  Note that the RUNBCKUP command passes six (6) discrete parameters to the exit program on every call (the call before the backup and the subsequent call after the backup), and the critical parameter here is the 2nd parameter passed which is 10-character alpha field &FLAG.  If the exit program is being called before the backup starts, field &FLAG will have the value *BEFORE, and if it is being called after the backup just ended field &FLAG will have the value *AFTER, it’s that simple.

In our sample program code, the subsystem named MFGSBS will be ended before the backup starts when the exit program is called with *BEFORE being passed.  The very same program will also unload the tape used after the backup completes when the exit program is called with *AFTER being passed by doing a dummy CHKTAP ENDOPT(*UNLOAD) command.

If you’re using the RUNBCKUP command in your environment to perform backup work and you have the need for some granular operational control, creating a custom exit program may be just what you need.

 

Exit Program Sample Code

 

PGM        PARM(&PRODID &FLAG &OPTIONS &DEVS &TAPSET +

&RETCODE)

DCL        VAR(&PRODID) TYPE(*CHAR) LEN(10) /* CALLING

PRODUCT. WILL BE ‘QEZBACKUP’ WHEN CALLED +

FROM OPERATIONAL ASSISTANT. */

DCL        VAR(&FLAG) TYPE(*CHAR) LEN(10) /* INDICATES

WHETHER BEFORE OR AFTER BACKUP.     */

DCL        VAR(&DEVS) TYPE(*CHAR) LEN(40) /* DEVICES +

USED.  */

DCL        VAR(&TAPSET) TYPE(*CHAR) LEN(4) /* TAPE SET

NAME  */

DCL        VAR(&RETCODE) TYPE(*CHAR) LEN(7) /* RETURN +

CODE    */

DCL        VAR(&OPTIONS) TYPE(*CHAR) LEN(10) /* OPTIONS

USED   */

IF         COND(&FLAG *EQ ‘*BEFORE    ‘) THEN(DO)

/*——————————————————–*/

/*  INSERT COMMANDS TO BE RUN BEFORE THE BACKUP HERE.     */

/*——————————————————–*/

ENDSBS     SBS(MFGSBS) OPTION(*IMMED)

ENDDO

IF         COND(&FLAG *EQ ‘*AFTER     ‘) THEN(DO)

/*——————————————————–*/

/*  INSERT COMMANDS TO BE RUN AFTER THE BACKUP HERE.      */

CHKTAP     DEV(TAP01) ENDOPT(*UNLOAD)

MONMSG     MSGID(CPF0000)

/*——————————————————–*/

ENDDO

ENDPGM

CHGBCKUP Command Screenshot – Specifying a Custom Exit Program

 

More from this month:

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *