Saving and restoring spooled files
For V5R4, you can use any of the methods described here to save and restore spooled files. This information contains a table that lists the commands and APIs in order of preference.
Before V5R4, use indirect methods to save and restore spooled files. These indirect methods might not preserve all of the attributes.
Table 1. Save and restore spooled files Save Methods Restore Methods Spooled file attributes preserved When used SAVLIB, SAVOBJ commands SAVRSTLIB, SAVRSTOBJ commands QSRSAVO API Save menu options 21-23 RSTLIB, RSTOBJ commands SAVRSTLIB, SAVRSTOBJ commands QSRRSTO API Restore menu options 21-23 Data and all attributes i5/OS® V5R4 only QSPOPNSP, QSPGETSP, QUSRSPLA APIs QSPCRTSP, QSPPUTSP, QSPCLOSP APIs Data, but not all attributes i5/OS V5R4 and earlier CPYSPLF, SAVOBJ commands CPYF command Textual data only i5/OS V5R4 and earlier When you save an output queue with the save commands, menu, or QSRSAVO API, you can choose to save all its spooled files. You can do this by specifying *ALL for the Spooled file data (SPLFDTA) command parameter, menu prompt or API key. When you restore output queues with the restore commands, menu, or QSRRSTO API, you can choose to restore any saved spooled files that do not already exist on the system. You can do this by specifying *NEW for the SPLFDTA parameter, prompt, or key. With the QSRSAVO and QSRRSTO APIs, you can also choose to save or restore spooled files by using a set of selection criteria. If you save spooled files with the QSRSAVO API using selection criteria and the *SPLF special library value, then use the QSRRSTO API with the *SPLF special library value to restore the spooled files.
This example describes how to save spooled files:
- Create an output queue to store the spooled files.
CRTOUTQ OUTQ(lib-name/que-name)- Use the Work with Spooled File (WRKSPLF) command to list the spooled files.
- Use option 2, Change Spooled File Attributes (CHGSPLFA) command to move the spooled files you wish to save to the output queue you created.
- Use the Save Object (SAVOBJ) command to save the spooled file data.
SAVOBJ OBJ(que-name) LIB(lib-name) DEV(dev-name) OBJTYPE(*OUTQ) SPLFDTA(*ALL)This example describes how to restore spooled files:
- Restore spooled files that are not already on the system.
RSTOBJ OBJ(que-name) SAVLIB(lib-name) DEV(dev-name) OBJTYPE(*OUTQ) SPLFDTA(*NEW)
Using spooled file APIs
If your source or target system is earlier than V5R4, you can use spooled file APIs as an indirect method to save and restore spooled files. This method preserves the spooled file data stream but not all of the attributes.
To save spooled files:
- The spooled files are opened using the Open Spooled File (QSPOPNSP) API.
- The spooled file data is retrieved using the Get Spooled File Data (QSPGETSP) API.
- The spooled file attributes are retrieved using the User Spooled File Attributes (QUSRSPLA)API.
To restore spooled files:
- The spooled files are created using the Create Spooled File (QSPCRTSP) API .
- The spooled file data is written to a new spooled file using the Put Spooled File Data (QSPPUTSP) API.
- The spooled file is closed using the Close Spooled File (QSPCLOSP) API.
The System API Reference in the i5/OS Information Center includes information about these APIs. You can find an example and a tool for using these APIs in the QUSRTOOL library in the TSRINFO member of the QATTINFO file.
Copying spooled files to database files
If your source or target system is earlier than V5R4, you can copy data between spooled files and database files as an indirect method to save and restore spooled files. This method copies textual data only and not advanced function attributes such as graphics and variable fonts. This method does not provide a complete solution for saving your spooled files.
The Copy Spooled File (CPYSPLF) command saves spooled file data to a database file. The Copy File (CPYF) command can copy data from a database file to a spooled file. Refer to Restoring Previous Release User Data to a New System in the Backup and Recovery book for more details.
View Entire GO SAVE checklist includes more information about menu options 21, 22, and 23 of the GO SAVE command.
Refer to Print restrictions in the Information center within the Print topic for restrictions of saving and restoring spooled files.
Parent topic:
Saving user data in your systemRelated tasks
GO SAVE: Option 21 (saving the entire system) GO SAVE: Option 23 (saving user data)Related information
Save and restore spooled files