From the author: This zip file contains a SAVF with the source, commands and programs for all of the save and restore SPLF commands. The objects were created and saved with a TGTRLS(V3R2M0). These commands were tested on both V5R1M0 and V4R5M0, but should work on any system from V3R2M0.
There are eight commands:
- SAVOUTQ, which will save all the SPLF's from a specified OUTQ
- SAVUSRSPLF, which will save all SPLF's for a specified USRPRF
- SAVJOBSPLF, which will save all SPLF's from a specified (fully qualified) JOB
- SAVSPLF, which will save any SPLF
- RSTOUTQ, which will restore all saved SPLF's from a specified OUTQ
- RSTUSRSPLF, which will restore all saved SPLF's from a specified USRPRF
- RSTJOBSPLF, which will restore all saved SPLF's from a specified JOB
- RSTSPLF, will restore any saved SPLF
At IMSG when we did our server consolidation to the 840 we used the SAVJOBSPLF and RSTJOBSPLF, as it was vital that every SPLF be restored with the same JOB and USRPRF as the original. A restored SPLF can even retain its original SPLNBR within the original JOB.
When saving SPLFs to a physical file, it's important to remember that the maximum number of SPLFs that can be created by a JOB in V5R1M0 is 999,999, but a physical file can only accommodate 32,767 members. To keep things simple, I suggest that the QMAXSPLF system value be 32,767 or less--then it's possible that every SPLF for a JOB could be saved within its own physical file. The physical file referenced by the SAV* commands will be created should it not already exist, and it's possible to automatically delete a SPLF once it's been successfully saved. Additionally, the SAVUSRSPLF command allows a SPLF creation date range to be specified.
The RSTOUTQ, RSTUSRSPLF and RSTJOBSPLF commands will always restore SPLFs with the same JOBNAME and where possible the same USRPRF as the original SPLF. Should the USRPRF not be found or the USRPRF is a restricted USRPRF (QDBSHR, QDOC, QLPAUTO, QLPINSTALL, QRJE, QSECOFR, QSPL, QDFTOWN, QTSTRQS, and QSYS), the restored SPLF will be restored with the USRPRF of the user that executes the RST* command. The original SPLF number from the original job can also be maintained by specifying ORGSPLNBR(*YES). Both the RSTOUTQ and RSTUSRSPLF also permit a SPLF save date range to be specified.
The SAVSPLF and RSTSPLF commands can save and restore any SPLF, including those saved by SAVOUTQ, SAVUSRSPLF and SAVJOBSPLF. The RSTOUTQ, RSTUSRSPLF and RSTJOBSPLF commands have been designed to only restore those SPLFs that have been saved by their corresponding SAV* command. For example, while the RSTOUTQ command can restore any SPLF saved by the SAVSPLF command, it can't restore any SPLF from SAVUSRSPLF and/or SAVJOBSPLF. The SAVSPLF and RSTSPLF commands really don't need to be used unless somebody wants to write their own SPLF archiving system.
As these coding examples don't have RPG and/or COBOL programs, I haven't written any SPLF index record that would log when and where every SPLF had been saved. But writing an SPLF index record should be a very easy job for any programmer. Because no SPLF index record is written, the RST* commands need to create an outfile of the members contained within an SPLF archive physical file. This can take some time depending on how many members make up the SPLF archive physical file.
The real advantage of these commands is that internally they use the QSPGETF and QSPPUTF APIs rather then the well-documented CPYSPLF examples, which permits Advanced Function Printing Data Stream (AFPDS) and Intelligent Data Stream (IPDS) SPLF to be saved and restored, whereas CPYSPLF cannot.