Problem solve Get help with specific problems with your technologies, process and projects.

Working in shades of SAV

Learn valuable backup options available under IBM's Save Object (SAV) command.

It's valuable to understand some of the different backup options available under IBM's Save Object (SAV) command, which is used to save any object in OS/400's Integrated File System (IFS). Using these options, you can perform a full save of the Integrated File System or a partial save of IFS files based on patterns in your file naming conventions. Partial saves come in handy for backing up information stored under a single IFS directory, such as the root directory of a Web server, a Domino directory, or an application data directory. Using partial IFS saves, you can segment your backup strategy to save different IFS directories to different tape drives or to move an application (such as a Domino server) to a save file or tape for migration to another system.

Given these benefits, let's look at some of the different options you can set on the SAV command and how they can help you implement both full and partial IFS backups.

1. To save the entire IFS -- excluding your native OS/400 libraries and document library objects (DLOs) -- to a tape drive, most people use a variant on the following SAV command:

SAV DEV('qsys.lib/tap01.devd') OBJ(('/*') ('/QSYS.LIB' *OMIT) ('/QDLS' *OMIT))

SAV uses the Objects (OBJ) parameter list to specify the IFS file system or folders to save. This particular statement saves the entire IFS starting at its root directory (as specified by the '/*' literal) to tape. It omits your native OS/400 DB2/UDB information (contained in the '/QSYS.LIB' file system) as well as your DLO system ('/QDLS'), which are also stored and accessed from the IFS root. This is essentially the same command IBM uses to save the IFS when you perform a full system backup off the green screen by using option 21 on the GO SAVE menu. When saving the entire IFS like this, it's important to omit the /QSYS.LIB and /QDLS paths, because they are generally saved through other OS/400 commands, and SAV's purpose is to save information from your IFS. It's also important to note that the device you're saving to -- TAP01 in this case -- must also entered under its IFS name (qsys.lib/tap01.devd) for the command to run properly.

2. If you want to save a certain folder (ex, /srch400) under the IFS root -- while ignoring all your other IFS folders -- you could execute the following command:

SAV DEV('qsys.lib/tap01.devd') OBJ(('/srch400*' *INCLUDE))

This segments your IFS backup by saving just those files and directories that match the '/srch400' pattern. If you wanted to segment the backup even more by excluding a sub-directory under '/srch400' called '/joe', you could omit that directory by modifying the statement to the following format:

SAV DEV('qsys.lib/tap01.devd') OBJ(('/srch400*') ('/srch400/joe*' *OMIT))

Like the previous example, this statement backs up everything in the '/srch400' IFS directory and its subdirectory but -- whenever the SAV statement encounters a file or directory the matches the '/srch400/joe' pattern -- it omits it from the backup.

If you want to modify the command to also save all directories under the '/techtrgt' directory on the IFS root, you can recode the SAV command to the following:

SAV DEV('qsys.lib/tap01.devd') OBJ(('/srch400*' *INCLUDE) ('/techtrgt' *INCLUDE) ('/srch400/joe*' *OMIT))

The end result of playing with the OBJ parameter list is that you can selectively back up one or more directories in the IFS by using patterns, while excluding other sub-directories that also match sub-patterns in your list. As a personal habit, I code all my *INCLUDE statements higher in the OBJ list and then enter the *OMIT statements lower. While I'm not sure this makes a difference in processing, it does make for an easier-to-read parameter list.

3. If you want to include or exclude all subdirectories for the patterns under your OBJ list, use the Directory subtree (SUBTREE) parameter. This parameter has four options: *ALL, which saves the first-level directories, all sub-directories and associated objects under the patterns listed in the OBJ list (*ALL is the default); *DIR, which save all the objects in the first level directories specified in the OBJ list, as well as the directory structure (but not the objects) of the sub-directories under each first level directory; *NONE, which only backs up objects and directories matching the pattern while excluding both the subdirectory entries and their corresponding objects; and *OBJ, which only saves objects that exactly match the object name pattern. So taking my earlier command that backs up any directory matching the '/srch400' pattern, I can explicitly tell SAV to back up the first-level directories and their sub-directories by changing it to the following:

SAV DEV('qsys.lib/tap01.devd') OBJ(('/srch400*' *INCLUDE)) TREE(*ALL)

If I wanted to want to back up only the '/srch400' directory while ignoring its subdirectories, I could change the statement to this:

SAV DEV('qsys.lib/tap01.devd') OBJ(('/srch400*' *INCLUDE)) TREE(*NONE)

And SAV will ignore '/srch400's subdirectory tree as it performs its backup.

If I wanted to back up the first-level '/srch400' directory and also back up the subdirectory structure under '/srch400' (but not the objects in each subdirectory), I would change my SUBTREE parameter to *DIR, as follows:

SAV DEV('qsys.lib/tap01.devd') OBJ(('/srch400*' *INCLUDE)) TREE(*DIR)

The SAV command can be fairly flexible and allow you to segment your IFS backup strategy in ways you may not have thought possible. And there is even another set of parameters that allow you to select files to be saved based on their last change or backup date (see the Time period for last change, CHGPERIOD, parameter on the command).

So be sure to take a second look at the OS/400 SAV command. It doesn't take much to master and it might help you backup that tricky set of files you've been trying to save.

About the author: Joe Hertvik is an IT professional and freelance writer who has been working with OS/400 since the days of the System/38 in the mid-1980s. Joe can be reached at


  • .Ku1laWvxlXc^2@.ee84638/1304>Spooled files go poof
    "Damien" was having a problem with print jobs not printing from his printer even though it went to PND, then WTR, and then a SAV status. From the iSeries, the job looked like it printed, but there was no output at the printer. He turned to the Search400 OS/400 Discussion Forum for advice. Read what other iSeries users suggested.
  • RST of information saved using SAV command
    This member wonders if a RST of information saved using SAV command has not been done when migrating from one iSeries to another. He turned to Search400 site expert John Brandt to see what implications might this have for future use of the IFS.
  • .snSEamCCeaq^0@.ee84639>Managing the iSeries Discussion Forum: Post your questions, and get answers from other iSeries systems managers and administrators as well as search400 experts.
  • Search400's Best Web Links on Systems Management

Dig Deeper on Performance