Midrange News for the IBM i Community

Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Saving SPOOL Files to Tape
has no ratings.
Published: 17 Oct 2012
Revised: 23 Jan 2013 - 1586 days ago
Last viewed on: 28 May 2017 (3585 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Saving SPOOL Files to Tape Published by: Bob Cozzi on 17 Oct 2012 view comments(1)

A lot of people were very happy when IBM finally introduced the ability to include SPOOL files on the SAVLIB/SAVOBJ commands. However, many backup procedures may not be backing up SPOOL files even if the new SPLFDTA(*ALL) parameter is specified.

Consider the following backup command:

             CLEAR(*ALL) SPLFDTA(*ALL) +
             OMITLIB(Q* #* $*) OMITOBJ((*ALL *JRNRCV))         

This is pretty standard. Save everything in all user libraries. Omit libraries that begin with the letter Q, pound sign or the dollar sign.

But along comes IBM i5 v5r4m0 and IBM includes the SPLFDTA keyword. So we add the SPLFDTA(*ALL) parameter to the above command and just assumed our SPOOL files are being saved.

They are probably not.

Most users, not all, but certainly most, define OUTPUT QUEUE objects objtype(*OUTQ) in library QUSRSYS, while others prefer QGPL. Since OMITLIB(Q*) is specified, these two libraries are NOT included in the save operation. Therefore the OUTQ's in those libraries are not saved. This makes SPLFDTA(*ALL) do virtually nothing for us.

The solution is simple, but perhaps not obvious; you certainly don't want to remove the OMITLIB(Q*) or you end up saving all that other, unwanted data. So the solution is to add a 2nd backup command, as follows:

             OBJTYPE(*OUTQ) ENDOPT(*REWIND) +     

This SAVOBJ command saves libraries QGPL and QUSRSYS to tape and includes the SPLFDTA(*ALL) parameter. The SPOOL files are saved at the end of the prior backup--separating them from it on the TAPE. This may be what you want. Since I only specify OBJTYPE(*OUTQ) only the SPOOL File data is saved along with the outq descriptions. So restoring them is as easy as a RSTOBJ command.

Be sure to add a ENDOPT(*LEAVE) keyword to your original SAVLIB *ALLUSR command, so that the tape stays where it belongs, and then include ENDOPT(*REWIND) on the SAVOBJ OBJTYPE(*OUTQ) command.

Return to midrangenews.com home page.
Sort Ascend | Descend


(Sign in to Post a Comment)
Posted by: Viking
Premium member *
Comment on: Saving SPOOL Files to Tape
Posted: 4 years 7 months 11 days 6 hours 36 minutes ago

Good tip - thanks Bob.