Planning a good backup strategy requires careful attention to detail. If you forget to save one important library or operating system component, you could be in trouble the next time you need to restore it to your system. In this article, I'll present a utility that can help you analyze your backup strategy.
The Display Save Information (DSPSAVINF) command will show you information concerning the last time you saved such things as user and system libraries, documents, configuration data, and security data. Using this utility on a regular basis will not only give you information that can help you restore your system, but (more importantly) help you identify components that haven't been saved recently or (worse) never saved at all.
Overview
When you run the DSPSAVINF command, you're presented with the Save Information screen shown in 1. On this screen, you'll find a list of various save and restore operations. This information is designed to identify when a particular operation was performed and what command was used to perform it. For example, the first item in the list in 1 shows that all user libraries were saved with the SAVLIB command on 10/25/95.
When you run the DSPSAVINF command, you're presented with the Save Information screen shown in Figure 1. On this screen, you'll find a list of various save and restore operations. This information is designed to identify when a particular operation was performed and what command was used to perform it. For example, the first item in the list in Figure 1 shows that all user libraries were saved with the SAVLIB command on 10/25/95.
You can view the additional information shown in 2 by pressing F11. Here, you'll find information that can be useful if you need to perform a restore operation. For example, the first item shows that all user libraries were saved to tape volume MC at sequence number 2. You can use these values as parameters on the Restore Library (RSTLIB) command. In this case, if you needed to restore all user libraries, you might enter the following command:
You can view the additional information shown in Figure 2 by pressing F11. Here, you'll find information that can be useful if you need to perform a restore operation. For example, the first item shows that all user libraries were saved to tape volume MC at sequence number 2. You can use these values as parameters on the Restore Library (RSTLIB) command. In this case, if you needed to restore all user libraries, you might enter the following command:
RSTLIB SAVLIB(*ALLUSR) + DEV(TAP01) VOL(MC) + SEQNBR(2)
Another way to run the DSPSAVINF command is to use the OUTPUT(*PRINT) option. This will generate a spooled file that contains a report similar to the one shown in 3. This report contains the same information presented on the screen, but on a single page that you can print and archive for future reference.
Another way to run the DSPSAVINF command is to use the OUTPUT(*PRINT) option. This will generate a spooled file that contains a report similar to the one shown in Figure 3. This report contains the same information presented on the screen, but on a single page that you can print and archive for future reference.
The Operational Assistant backup facility, which is part of OS/400, contains a command that at first appears to be similar to the DSPSAVINF command (see "The Operational Assistant Backup Facility," MC, August 1994). The Display Backup Status (DSPBCKSTS) command allows you to display information about the tape sets used for backups and what was saved on each of them. However, only information about backups performed using the Operational Assistant backup facility is displayed. If you're not using the Operational Assistant backup facility, the DSPBCKSTS command won't show any information. The DSPSAVINF command will show you this type of information whether you use the Operational Assistant or the traditional OS/400 save commands to perform your backups.
The basic task of the DSPSAVINF utility is to retrieve and present information from the operating system concerning the last use of various OS/400 save commands. OS/400 maintains a set of data areas that contain this information in their descriptions. You could manually use the Display Object Description (DSPOBJD) command on each data area and scroll through the pages of output to locate this information. However, this utility makes it much easier by retrieving the descriptions of these data areas programatically and presenting them in a much more concise format. In the next section, I'll explain the code that allows this utility to accomplish this task.
The Nuts and Bolts
The source code for the DSPSAVINF command is shown in 4. This command accepts a single parameter called OUTPUT with two possible values: * or *PRINT. This parameter allows the user to select between sending the output to the screen or a spooled file.
The source code for the DSPSAVINF command is shown in Figure 4. This command accepts a single parameter called OUTPUT with two possible values: * or *PRINT. This parameter allows the user to select between sending the output to the screen or a spooled file.
The DSPSAVINF command executes the SAV002CL program shown in 5 as its command processing program (CPP). The SAV002CL program starts by determining if it is running in batch or interactively. If it's running in batch, it forces the output to a spooled file. Next, it executes the Display Object Description (DSPOBJD) command to create a file containing the descriptions of all data areas in QSYS that start with the letters QSAV.
The DSPSAVINF command executes the SAV002CL program shown in Figure 5 as its command processing program (CPP). The SAV002CL program starts by determining if it is running in batch or interactively. If it's running in batch, it forces the output to a spooled file. Next, it executes the Display Object Description (DSPOBJD) command to create a file containing the descriptions of all data areas in QSYS that start with the letters QSAV.
These data areas, which I mentioned earlier, contain save and restore information in their descriptions. Once the DSPOBJD command is run, this information is placed into a file called SAV002PF in QTEMP. Next, the SAV002CL program retrieves the system name to place on the report and calls an RPG program to display or print the information stored in the newly created SAV002PF file.
To display the information on the screen, this utility uses the display file SAV002DF (shown in 6). This display file contains two subfiles, one for each of the views the user can toggle between using F11. To create the report, the utility uses the printer file SAV002PR, shown in 7. These two files are used by the SAV002RG program, shown in 8.
To display the information on the screen, this utility uses the display file SAV002DF (shown in Figure 6). This display file contains two subfiles, one for each of the views the user can toggle between using F11. To create the report, the utility uses the printer file SAV002PR, shown in Figure 7. These two files are used by the SAV002RG program, shown in Figure 8.
The SAV002RG program begins by opening either the printer file or the display file, depending on the value of the OUTPUT parameter. The program then drops into a read loop, where it reads the output file created by the DSPOBJD command. Within the read loop, the program either prints detail lines to the printer file or writes subfile records to the display file. After all the records have been read, the program either prints the report footing or displays the screen to the user. If it displays the screen, it performs a loop that executes as long as the user presses F11. Within this loop, the program alternates between displaying the two subfiles. When the user presses Enter, F3, or F12, the program ends.
Considerations
The DSPSAVINF utility will give you information about most of the save operations you can perform on the AS/400. However, there are a few that won't be shown. For example, if you use the Save Library (SAVLIB) command to save individual libraries by name rather than specifying *ALLUSR, you won't see that reflected in the output. However, there is enough information presented by this utility to give you a good representation of the status of your backup strategy.
There are several ways to use the DSPSAVINF utility. The most obvious is to use it interactively to display the results at your terminal. However, you might also consider placing this command at the end of your backup procedure and sending the output to a printer. You could then archive copies of this report so that, in the event of a system failure, you would have them available to assist you in determining the information you need to restore your system. Another way to run this command regularly would be to put it into an entry in the OS/400 job scheduler so it runs automatically every day. That way, you would always have a recent copy of the report if the need arises. No matter which way you decide to implement this utility in your shop, I hope you find it a useful tool that can help you improve the quality and reliability of your backup strategy.
Robin Klima is a senior technical editor at Midrange Computing.
REFERENCES
OS/400 Backup and Recovery?Advanced V3R1 (SC41-3305, CD-ROM QBKALF00).
OS/400 Backup and Recovery?Basic V3R1 (SC41-3304, CD-ROM QBKALE01).
The Display Save Information Utility
Figure 1: The Save Information Screen
The Display Save Information Utility
Figure 2: The Save Information Alternate View
The Display Save Information Utility
Figure 3: The Save Information Report
10/25/95 9:47:40 Save Information System: MCPGMR Save Restore Save Device Saved Seq File Description Date Date Command Type Volume Nbr Label SAVE/RESTORE LIB(*ALLUSR) 10/25/95 SAVLIB Tape MC 2 QFILE SAVE CONFIGURATION 10/25/95 SAVCFG Tape MC 116 QFILEIOC SAVDLO *ALL 10/25/95 4/12/95 SAVDLO Tape MC 1 QDOC SAVE/RESTORE LIB(*IBM) 7/27/94 7/30/94 SAVLIB Tape MC 13 QFILE SAVE/RESTORE LIB(*NONSYS) 8/19/94 SAVLIB Tape MC 13 QFILE SAVE STORAGE SAVE SYSTEM 3/18/95 SAVSYS Tape MC 1 QFILEIML RESTORE USER PROFILES 10/25/95 SAVSECDTA Tape MC 117 QFILEUPR * * * * * E N D O F L I S T I N G * * * * *
The Display Save Information Utility
Figure 4: The DSPSAVINF Command
/*===============================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/DSPSAVINF) PGM(XXX/SAV002CL) + */ /* SRCFILE(XXX/QCMDSRC) */ /* */ /*===============================================================*/ CMD PROMPT('Display Save Information') PARM KWD(OUTPUT) TYPE(*CHAR) LEN(6) RSTD(*YES) + DFT(*) VALUES(* *PRINT) PROMPT('Output')
The Display Save Information Utility
Figure 5: CL Program SAV002CL
/*===============================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/SAV002CL) SRCFILE(XXX/QCLSRC) */ /* */ /*===============================================================*/ PGM PARM(&OUTPUT) DCL VAR(&OUTPUT) TYPE(*CHAR) LEN(6) DCL VAR(&TYPE) TYPE(*CHAR) LEN(1) DCL VAR(&SYSNAME) TYPE(*CHAR) LEN(8) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(80) /* Send all errors to error handling routine */ MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR)) /* If running in batch send output to *PRINT */ RTVJOBA TYPE(&TYPE) IF COND(&TYPE *EQ '0') THEN(CHGVAR VAR(&OUTPUT) + VALUE('*PRINT')) /* Create output file */ DSPOBJD OBJ(QSYS/QSAV*) OBJTYPE(*DTAARA) + DETAIL(*FULL) OUTPUT(*OUTFILE) + OUTFILE(QTEMP/SAV002PF) /* Retrieve system name */ RTVNETA SYSNAME(&SYSNAME) /* Call program to display save information */ OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/SAV002PF) CALL PGM(SAV002RG) PARM(&OUTPUT &SYSNAME) DLTOVR FILE(QADSPOBJ) /* Branch around error handling routine */ GOTO CMDLBL(ENDPGM) /* Error handling routine */ ERROR: RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) + MSGTYPE(*ESCAPE) ENDPGM: ENDPGM
The Display Save Information Utility
Figure 7: Printer File SAV002PR
*=============================================================== * To compile: * * CRTPRTF FILE(XXX/SAV002PR) SRCFILE(XXX/QDDSSRC) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A R PRTHDR A 1 1DATE(*SYS) EDTCDE(Y) A 1 12TIME EDTWRD(' : : ') A 1 59'Save Information' A 1114'System:' A SYSNAM 8 O 1122 A 3 33'Save' A 3 45'Restore' A 3 60'Save' A 3 75'Device' A 3 89'Saved' A 3103'Seq' A 3114'File' A 4 2'Description' A 4 33'Date' A 4 46'Date' A 4 60'Command' A 4 75'Type' A 4 89'Volume' A 4103'Nbr' A 4114'Label' A R PRTDTL SPACEB(1) A SAVDSC 27 O 2 A SAVDAT 6 0O 31EDTWRD(' / / ') A RSTDAT 6 0O 44EDTWRD(' / / ') A ODSCMD 10 O 60 A ODSDEV 10 O 75 A ODSV01 6 O 89 A ODSSQN 4 0O 102EDTCDE(4) A ODLBL 17 O 114 A R PRTFTR SPACEB(2) A 41'* * * * *' A 53'E N D O F L I S T I N G' A 83'* * * * *' *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
The Display Save Information Utility
Figure 8: RPG Program SAV002RG
*=============================================================== * To compile: * * CRTRPGPGM PGM(XXX/SAV002RG) SRCFILE(XXX/QRPGSRC) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 FQADSPOBJIF E DISK FSAV002PRO E PRINTER UC FSAV002DFCF E WORKSTN UC F RRN KSFILE DSPDTL1 F RRN KSFILE DSPDTL2 * C *ENTRY PLIST C PARM OUTPUT 6 C PARM SYSNAM 8 * * Open either the print file or the display file C OUTPUT IFEQ '*PRINT' C OPEN SAV002PR C WRITEPRTHDR C ELSE C OPEN SAV002DF C ENDIF * C READ QLIDOBJD 99 C *IN99 DOWEQ*OFF C MOVE ODOBTX SAVDSC C MOVE ODSDAT SAVDAT C MOVE ODRDAT RSTDAT * * Print detail line or write record to subfile C OUTPUT IFEQ '*PRINT' C WRITEPRTDTL C ELSE C ADD 1 RRN 50 C MOVE *ON *IN90 C WRITEDSPDTL1 C WRITEDSPDTL2 C ENDIF * C READ QLIDOBJD 99 C ENDDO * * Print footer or display screen C OUTPUT IFEQ '*PRINT' C WRITEPRTFTR C ELSE C *IN11 DOUEQ*OFF C *IN50 IFEQ *OFF C WRITEDSPHDR1 C MOVE *ON *IN50 C ELSE C WRITEDSPHDR2 C MOVE *OFF *IN50 C END C EXFMTDSPFTR C ENDDO C ENDIF * C MOVE *ON *INLR *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
LATEST COMMENTS
MC Press Online