Determining When a SAVSYS and Other IBM i Save Commands Were Performed on a System
Oh Where Oh Where Can My System Save Information Be…?
With its unique integrated architecture, the IBM i system has many inherent strengths, not the least of which is fully baked-in and robust save/restore functionality. When you save an object on the system such as a file or a data area or a program in a user library with commands such as SAVLIB or SAVOBJ, the system will inform you on the “when” and the “where” of the save of that object by displaying the saved date/time of the object and the save media or save file used to do the save. For example, if you want to know the last time file QRPGLESRC in library QGPL was saved and what it was saved to, you would simply execute command DSPOBJD OBJ(QGPL/QRPGLESRC) OBJTYPE(*FILE) and take option #5 to display the full attributes, and then scroll down to the last screen where the system tells you the last save date and time and the tape volume ID or save file used to save the object, this is basic functionality that we are all familiar with.
But what about system objects? When was the last time that you saved all the user profiles on your system with a SAVSECDTA or SAVSYS command and what specific tape were they saved on? What about your last SAVLIB LIB(*NONSYS) command, when was that done last and on what media can I find it? Well IBM i provides an easy and logical way to determine the “when” and the “where” for these types of system saves. There are 8 special data areas on the system that provide when/where information on specific IBM i save commands, the table below is a list of the data areas and which discrete IBM i save commands update them:
|Command||Data Area Updated|
|SAVSYS||QSYS/QSAVSYS, QSYS/QSAVUSRPRF, QSYS/QSAVCFG|
If you display any of the above data areas using the standard DSPDTAARA command, you will discover that they are empty, just 32 blanks staring at you… So how are they used to determine the last time the associated save command was ran and on what save media? You use these data areas by doing a DSPOBJD command on the data area object itself to see what the save date/time is for the data area object and what save media was used, this will be the last save date/time of the associated system save command and the media that was used for that specific command. For example, to determine the last time the SAVSYS command was ran and what save media was used, you would simply enter the command DSPOBJD OBJ(QSYS/QSAVSYS) OBJTYPE(*DTAARA) and then take option #5 to display the full attributes, and then scroll down to the last screen which will look like the screen below. From this screen you can now determine that the last time a SAVSYS command was run was on 1/20/17 at 5:47 PM and the save was made onto media volume IV0000.
It is important to note that if you specify UPDHST(*NO) on the SAVLIB *ALLUSR, SAVLIB *IBM, or SAVLIB *NONSYS commands the system will not update the save date/time on the QSAVALLUSR, QSAVIBM, and QSAVLIBALL data areas respectively.
But what about full system saves that are done through the venerable GO SAVE menu option #21? An option #21 full system save will of course execute the individual commands discussed above such as SAVSYS and SAVLIB *NONSYS and update the respective data areas, but, is there a way to find out “when” the GO SAVE option #21 full save itself was ran and how long each discrete save command took? Well, there is! There is yet one more special system data area named QSRSAV21 and it resides in library QUSRSYS. Unlike the special data areas discussed above which are “empty” data areas that provide their information via a DSPOBJD executed against it, the QSRSAV21 data area is not “empty” and provides its information via its contents. To determine when your last GO SAVE option #21 was executed and how long each discrete save command took to run, simply display the contents of the data area using command DSPDTAARA DTAARA(QUSRSYS/QSRSAV21) and you will see information as shown below. From the example below you can see that the last time a GO SAVE option #21 was ran was on 1/20/2017 at 5:46 PM onto save device TAPMLB03 and the SAVSYS command took approximately 7 minutes to run when compared to the start time of 5:53 PM for the SAVLIB command.
IBM i save/restore capabilities are legendary, and the save information provided by the system data areas discussed here are a natural extension of those capabilities. Look at these data areas on your own system and learn to use them as part of your overall system save management strategy.