SAVLIB (Save Library)

SAVLIB Command syntax diagram

 

Purpose

The Save Library (SAVLIB) command allows the user to save a copy of a one or more libraries.

When saving to a save file only one library can be specified.

Documents and folders contained in QDOC library can be saved by the Save Document Library Object (SAVDLO) command.

The SAVLIB command saves the entire library; this includes the library description, the object descriptions, and the contents of the objects in the library. For job queues, message queues, output queues, data queues, and logical files, only the object definitions are saved, not the contents. Logical file access paths may be saved, however, by using the ACCPTH parameter. The contents of a save file can be saved by using the Save Save File Data (SAVSAVFDTA) command or by using the SAVFDTA parameter on the SAVLIB command. The libraries and their objects are not affected in the system unless the command specifies that the storage is to be freed. However, unless UPDHST(*NO) is specified, the description of each library and each object is updated with the date, place, and time it was last saved. If a group of libraries is saved by specifying *NONSYS, *ALLUSR, or *IBM for the LIB parameter, the date, time, and place are updated in the history information for a data area in QSYS (data area QSAVLIBALL, QSAVALLUSR, or QSAVIBM).

The types of objects saved by this command are the same as those listed for the OBJTYPE parameter in with the addition of *DTADCT. Certain OS/400 system objects that are not contained in user libraries (such as user profiles) are not saved by this command. They can be saved by the Save System (SAVSYS) or Save Security Data (SAVSECDTA) commands.

Note: This command ignores all file overrides currently in effect for the job, except for the listing file.

 

Restrictions

  1. To use this command, the user must have either the special authority *SAVSYS specified in the user profile by the SPCAUT parameter, or the user must have:

    • Read authority for, or be the owner of, each library specified and
    • Object existence authority for each object in the library.

    If the user does not have the correct authorities for all of the libraries and objects specified, only those for which the user does have authority are saved.

  2. When saving to tape, diskette, or optical volume, the user must have *USE authority to the device description.
  3. When saving to a save file, the user must have add authority and use authority to the save file.
  4. When using a media definition, the user must have *USE authority to the media definition and *EXECUTE authority to the media definition library.
  5. When using the OUTFILE parameter to save to an existing database file, the user must have execute authority to the output file library.
  6. All diskettes used to save the libraries should be initialized in the save/restore format. If tape is used, a standard labeled tape volume should be used.
  7. No library being saved, or the objects in it, can be updated by a job that is running at the time the save operation occurs unless save-while-active is used.
  8. When the contents of a save file are being saved to the same save file by specifying SAVFDTA(*YES), only the description of the save file is saved.
  9. When the contents of a save file are saved by specifying *YES on the SAVFDTA parameter, the save file must be restored before objects contained in it can be restored.
  10. Specifying USEOPTBLK(*YES) may result in a tape that can be duplicated only to a device that supports the same block size.

 

Required Parameters

LIB
Specifies which libraries are saved.

 

Notes

  1. If the user specifies *ALLUSR or *IBM on this parameter, this command should be run when the specified libraries are not being used. If objects in a library are in use while the library is being saved, the objects are not saved. To ensure a complete save of all libraries, run this command with the system in a restricted state. For example, if SAVLIB LIB(*ALLUSR) is run when the subsystem QSNADS is active, the QAO* files are not saved in library QUSRSYS. To save the QAO* files, end the QSNADS subsystem before running SAVLIB LIB(*ALLUSR).
  2. Doing a SAVLIB LIB(*IBM) and then doing a SAVLIB LIB(*ALLUSR) saves the same libraries as a SAVLIB LIB(*NONSYS), but requires two restore commands.

*NONSYS: All user-created libraries, the QGPL and QUSRSYS libraries, and licensed program libraries such as QRPG and QIDU are saved. All subsystems must be ended by the End Subsystem (ENDSBS) or End System (ENDSYS) command before this option is specified. When *NONSYS is specified, the libraries are saved in alphabetical order on the media.

*ALLUSR Libraries

The following libraries with names that do not begin with the letter Q are also saved:

#CGULIB      #DSULIB      #SEULIB
#COBLIB      #RPGLIB
#DFULIB      #SDALIB

generic*-library-name: Specify the generic name of the library. A generic name is a character string of one or more characters followed by an asterisk (*); for example, ABC*. The asterisk (*) substitutes for any valid characters. A generic name specifies all libraries with names that begin with the generic prefix, for which the user has authority. If an asterisk is not included with the generic (prefix) name, the system assumes it to be the complete library name. A maximum of 300 generic library names can be specified. For more information on the use of generic functions, refer to generic functions.

library-name: Specify the names of the libraries to be saved. A maximum of 300 libraries can be specified.

The names QDOC, QDOCxxxx, QRCYxxxxx, QRECOVERY, QRPLOBJ, QRPLxxxxx, QSPL, QSPLxxxx, QSRV, QSYS, QSYSxxxxx, and QTEMP cannot be specified.

 

Notes

  1. When several library names are specified, the overall save time is reduced, compared to that required to save objects from each of the libraries by using individual commands.
  2. Only one library can be specified when saving to a save file.


DEV
Specifies the name of the device on which the libraries are saved. The device name must already be known on the system by a device description.

*SAVF: The save operation is done using the save file specified by the Save File (SAVF) parameter.

*MEDDFN: The save operation is done using the devices and media identified in the media definition specified by the Media Definition (MEDDFN) parameter.

diskette-device-name: Specify the name of the diskette device used to save the objects.

optical-device-name: Specify the name of the optical device used for the save operation.

tape-media-library-device-name: Specify the name of the tape media library device used for the save operation.

tape-device-name: Specify the names of one or more tape devices or one media library device used for the save operation. If multiple tape devices are specified, they must have compatible media formats and they are used serially in the order in which they are specified. Using more than one tape device permits one tape volume to be rewound and unloaded while another tape device processes the next tape volume. To use more than one device in parallel, a media definition must be specified.

 

Optional Parameters

VOL
Specifies the volume identifiers of the volumes, or the cartridge identifier of a tape in a tape media library device, on which the data is saved. The volumes must be placed in the device in the order specified on this parameter. More information on this parameter is in commonly used parameters.

*MOUNTED: The data is saved on the volumes placed in the device. For a media library device, the volume to be used is the next cartridge in the category mounted by the Set Tape Category (SETTAPCGY) command.

Note: This value cannot be specified when using an optical media library device.

volume-identifier: Specify the identifiers of up to 75 volumes in the order they are placed in the device and used to save the system data.

SEQNBR
Specifies, only when a tape is used, which sequence number is used as the starting point for the save operation.

*END: The system saves the library starting after the last sequence number on the first tape. If the first tape is full, an error message is issued and the operation ends.

file-sequence-number: Specify the sequence number of the file. Valid values range from 1 through 16777215.

If *NONSYS, *ALLUSR, or *IBM is specified on the LIB parameter, the save operation for the set of libraries begins at the sequence number specified. The first file saved in this set is the QFILE file. The QFILE file contains the list of libraries saved.

LABEL
Specifies the name that identifies the data file on the tape or diskette that is used for the save operation. If the LABEL parameter is used on the save command, the user must specify this label on the restore command.

*LIB: The file label is created by the system using name of the library specified on the LIB parameter.

data-file-identifier: Specify the data file identifier (up to 17 characters) of the data file used for the save operation. This option is valid only for saving a single library. Do not specify *SAVLIB; the system will return an error message if *SAVLIB is specified.

EXPDATE
Specifies the expiration date. The files cannot be overwritten until the expiration date. The expiration date must be later than or equal to the current date.

*PERM: The files are permanently protected.

expiration-date: Specify the date when protection for the file ends.

Note: For operations to diskette, the end date specified must be later than the date of the save operation. Otherwise, the ended save/restore files may be lost when the next save/restore file is written during the save operation.

ENDOPT
Specifies the operation that is automatically performed on the tape or optical volume after the save operation ends. If more than one volume is used, this parameter applies only to the last volume used; all other volumes are unloaded when the end of the volume is reached.

Note: This parameter is valid only if a tape or optical device name is specified on the DEV parameter. For optical devices, *UNLOAD is the only special value supported, *REWIND and *LEAVE will be ignored.

*REWIND: The tape is automatically rewound, but not unloaded, after the operation has ended.

*LEAVE: The tape does not rewind or unload after the operation ends. It remains at the current position on the tape drive.

*UNLOAD: The tape is automatically rewound and unloaded after the operation ends. Some optical devices will eject the volume after the operation ends.

STRLIB
Specifies the library with which to begin the *NONSYS, *IBM, or *ALLUSR save.

If an irrecoverable media error occurs during the save operation, this parameter can be used to restart the operation.

Note: In the steps that follow, *NONSYS is specified on the LIB parameter. If you are restoring IBM-supplied libraries or all user-created libraries and IBM-supplied libraries, specify *IBM or *ALLUSR instead.

The basic steps for restarting a save operation are:

  1. Check the job log to determine the library where the previous save operation failed. Find the last library saved, which is indicated by a successful save completion message.
  2. Load the next tape and ensure the tape is initialized.
  3. Issue the following command:
    SAVLIB LIB(*NONSYS) DEV(TAP01) ENDOPT(*LEAVE)
         STRLIB(library-name) ACCPTH(*YES)
         OMITLIB(library-name)
    

    where the library-name for the STRLIB and OMITLIB parameters is the last library successfully saved. This starts the save operation on the library after the last successfully saved library. Specify the value for the ACCPTH parameter that was specified on the previous SAVLIB command.

    Note: Restoring the system using this set of media requires two RSTLIB SAVLIB(*NONSYS) commands to restore the libraries.

*FIRST: The save operation begins with the first library in alphabetic order.

library-name: Specify the name of the library with which to begin the save.

SAVF
Specifies the qualified name of the save file used to contain the save data. The save file must be empty or CLEAR(*ALL) must be specified.

The name of the save file can be qualified by one of the following library values:

*LIBL: All libraries in the job's library list are searched until the first match is found.

*CURLIB: The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.

library-name: Specify the name of the library to be searched.

save-file-name: Specify the name of the save file.

MEDDFN
Specifies the qualified name of the media definition that identifies the devices and media used to contain the save data. For information about creating and using a media definition, see the Set up saves to multiple devices article in the Information Center.

Note: If a media definition is specified, the VOL, SEQNBR, SAVF, and OPTFILE parameters cannot be specified. The volume identifiers and sequence numbers are specified in the media definition.

The name of the media definition can be qualified by one of the following library values:

*LIBL: All libraries in the job's library list are searched until the first match is found.

*CURLIB: The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.

library-name: Specify the name of the library to be searched.

media-definition-name: Specify the name of the media definition.

UPDHST
Specifies whether the save history information of each saved object is updated with the date, time, and location of the current save operation. The save history information for an object is displayed using the Display Object Description (DSPOBJD) command. The save history information is used to determine which journal entries are processed when RCVRNG(*LASTSAVE) and FROMENT(*LASTSAVE) are used on the Apply Journaled Changes (APYJRNCHG) command.

*YES: The last save date, time, and location information is updated for each object saved.

*NO: The save history information contained in the description of each object saved is not updated.

Note: UPDHST(*NO) should be used for a save operation that is not intended for recovery. For example, if the save data is transmitted, record by record, to another system and the save file is immediately deleted, the user will probably not want to update the save history information.

OMITLIB
Specifies the names of one of more libraries, or the generic names of each group of libraries, to be excluded from the save operation. If a value other than *NONE is specified then up to 300 values can be specified.

*NONE: No libraries are excluded from the save operation.

generic*-library-name: Specify a generic name. A generic name is a character string of one or more characters followed by an asterisk (*); for example, ABC*. The asterisk (*) substitutes for any valid characters. A generic name specifies all libraries with names that begin with the generic prefix, for which the user has authority. If an asterisk is not included with the generic (prefix) name, the system assumes it to be the complete library name. See generic names for additional information.

library-name: Specify the name of the library to be excluded from the save operation.

OMITOBJ
Specifies the objects to be excluded from the save operation. Up to 300 objects or generic object values can be specified.

If the OMITOBJ parameter is not specified, no objects are excluded from the save operation.

*NONE: No objects are excluded from the save operation.

Element 1: Object Name

The object name can be qualified by one of the following library values:

*ALL: The specified objects are excluded from all libraries that are part of the save operation.

generic*-library-name: Specify the generic name of the library. A generic name is a character string of one or more characters followed by an asterisk (*); for example, ABC*. The asterisk (*) substitutes for any valid characters. A generic name specifies all libraries with names that begin with the generic prefix, for which the user has authority. If an asterisk is not included with the generic (prefix) name, the system assumes it to be the complete library name. For more information on the use of generic functions, refer to generic object names.

library-name: Specify the name of the the library that contains the object to be excluded from the save operation.

*ALL: Objects in the specified libraries are excluded, depending on the value specified for the object type.

generic*-object-name: Specify the generic name of the object. A generic name is a character string of one or more characters followed by an asterisk (*); for example, ABC*. The asterisk (*) substitutes for any valid characters. A generic name specifies all objects with names that begin with the generic prefix, for which the user has authority. If an asterisk is not included with the generic (prefix) name, the system assumes it to be the complete object name. For more information on the use of generic functions, refer to generic object names.

object-name: Specify the name of the object that will be excluded from the save command.

Element 2: Object Type

*ALL: All object types are excluded from the save operation, depending on the value specified for the object name.

object-type: Specify the type of the object to be excluded from the save operation.

ASPDEV
Specifies the name of the auxiliary storage pool (ASP) device to be included in the save operation.

*: The operation includes the system ASP (ASP number 1), all basic user ASPs (ASP numbers 2-32), and, if the current thread has an ASP group, all independent ASPs in the ASP group.

*SYSBAS: The system ASP and all basic user ASPs are included in the save operation.

*CURASPGRP: If the current thread has an ASP group, all independent ASPs in the ASP group are included in the save operation.

auxiliary-storage-pool-device-name: Specify the name of the independent ASP device to be included in the save operation. End of change

TGTRLS
Specifies the release level of the operating system on which you intend to restore and use the object.

When specifying the target-release value, the format VxRxMx is used to specify the release, where Vx is the version, Rx is the release, and Mx is the modification level. For example, V5R2M0 is version 5, release 2, modification level 0.

Valid values depend on the current version, release, and modification level, and they change with each new release. See the Values for TGTRLS Parameter table in the Backup and Recovery book for a complete list of valid values.

To specify that an object be saved for distribution to a system at a different release level than the system on which the save operation is to occur, the procedure differs for program and non-program objects and by the release level on which program objects are created. If, for example, you are saving an object for distribution to a target system running on an earlier release, you have the following choices:

For program objects

  • If the program was created at a release level more current than the targeted earlier release, (1) create the program again specifying the targeted earlier release, (2) save the program specifying the targeted earlier release, and then (3) restore the program on the target system.
  • If the program was created at the same release level as the target system, you can (1) save the program specifying the targeted earlier release and then (2) restore the program on the target system.

For non-program objects

You can (1) save the object specifying the targeted earlier release and then (2) restore the object on the target system.

 

Notes

  1. If LIB(*NONSYS), LIB(*ALLUSR), or LIB(*IBM) is specified, only the current release can be the target release.
  2. Not all objects can be targeted to another release. To find out which objects are supported, see the table in the Backup and Recovery book.
  3. Use the table in the Backup and Recovery book to find out the values that can be specified, and which release is specified when you choose the *CURRENT and *PRV values, on your operating system.

*CURRENT: The object is to be restored to, and used on, the release of the operating system currently running on your system. The object can also be restored to a system with any subsequent release of the operating system installed.

*PRV: The object is to be restored to the previous release with modification level 0 of the operating system. The object can also be restored to a system with any subsequent release of the operating system installed.

target-release: Specify the release in the format VxRxMx. The object can be restored to a system with the specified release or with any subsequent release of the operating system installed.

CLEAR
Specifies whether active data on the media is automatically cleared or replaced. Active data is any file on the media that has not expired. Clearing active data removes all files from the volume, starting at the specified sequence number for tape. Replacing active data on optical media replaces only the optical files created by this operation.

 

Notes

  1. Clearing a tape does not initialize it. You should initialize tapes to a standard label format before the save command is issued by using the Initialize Tape (INZTAP) command and specifying a value on the NEWVOL parameter.
  2. Clearing an optical volume does initialize it.
  3. Clearing a diskette does not initialize it. You should initialize diskettes to a save and restore format before the save command is issued by using the Initialize Diskette (INZDKT) command and specifying FMT(*SAVRST).
  4. If a volume that is not initialized is encountered during the save operation, an inquiry message is sent and an operator can initialize the volume.

*NONE: None of the media is automatically cleared. If the save operation encounters active data on a tape, diskette, or save file, an inquiry message is sent, allowing the operator to either end the save operation or clear the media. If the save operation encounters the specified optical file, an inquiry message is sent, allowing the operator to either end the save operation or replace the file.

*ALL: All of the media is automatically cleared.

If tapes are used and a sequence number is specified on the SEQNBR parameter, the first tape is cleared beginning at that sequence number. All tapes following that first tape are completely cleared. To clear the entire first tape, SEQNBR(1) must be specified.

*AFTER: All media after the first volume is automatically cleared. If the save operation encounters active data on the first tape or diskette, an inquiry message is sent, allowing the operator to either end the save operation or clear the media. If the save operation encounters the specified optical file on the first volume, an inquiry message is sent, allowing the operator to either end the save operation or replace the file.

Note: The *AFTER value is not valid for save files.

*REPLACE: Active data on the media is automatically replaced. Optical volumes are not initialized. Tapes, diskettes, and save files are automatically cleared in the same way as the *ALL value.

PRECHK
Specifies whether the save operation for a library should end if all objects in the library specified by this command do not satisfy the following conditions of the save operation:

  • The objects exist,
  • They are not found to be damaged,
  • They are not locked by another job, and
  • The requester of the save operation has authority to save the objects.

Note: When multiple libraries are specified, PRECHK(*YES) applies to each library independently. For example, the failure to save one library does not affect the saving of other libraries. However, if PRECHK(*YES) and SAVACT(*SYNCLIB) are specified and an object in any library to be saved does not pass the preliminary check, the save operation ends and no libraries are saved.

*NO: Allows the save operation for a library to continue, saving only objects that can be saved.

*YES: Ends the save operation for a library before any data is written if, after all objects in the specified library are checked, one or more objects cannot be saved. If multiple libraries are specified, the save operation continues with the next library.

SAVACT
Specifies whether an object can be updated while it is being saved.

Note: If your system is in a restricted state, this parameter is ignored and the save operation is performed as if SAVACT(*NO) was specified.

*NO: Objects that are in use are not saved. Objects cannot be updated while being saved.

*LIB: Objects in a library can be saved while they are in use by another job. All of the objects in a library reach a checkpoint together and are saved in a consistent state in relationship to each other.

Note: Libraries with thousands of objects may be too large for this option.

*SYNCLIB: Objects in a library can be saved while they are in use by another job. All of the objects and all of the libraries in the save operation reach a checkpoint together and are saved in a consistent state in relationship to each other.

*SYSDFN: Objects in a library can be saved while they are in use by another job. Objects in a library may reach checkpoints at different times and may not be in a consistent state in relationship to each other.

Note: Specifying this value eliminates some size restrictions and may enable a library to be saved that could not be saved with SAVACT(*LIB).

SAVACTWAIT
Specifies the amount of time to wait for a commit boundary or an object that is in use before continuing the save. If a lock is not obtained in the specified time, the object is not saved. If a commit boundary is not reached in the specified time, the save operation is ended.

120: The system waits up to 120 seconds for a commit boundary or an object lock before continuing the save operation.

*NOMAX: No maximum wait time exists.

wait-time: Specify the time (in seconds) to wait for a commit boundary or an object lock before continuing the save operation. Valid values range from 0 through 99,999.

SAVACTMSGQ
Specifies the message queue that the save operation uses to notify the user that the checkpoint processing for a library is complete. A separate message is sent for each library to be saved when SAVACT(*SYSDFN) or SAVACT(*LIB) is specified. When SAVACT(*SYNCLIB) is specified, one message is sent for all libraries in the save operation.

This parameter can be used to save the objects at a known, consistent boundary to avoid additional recovery procedures following a restore operation. Applications can be stopped until the checkpoint processing complete message is received.

*NONE: No notification message is sent.

*WRKSTN: The notification message is sent to the work station message queue.

The name of the message queue can be qualified by one of the following library values:

*LIBL: All libraries in the job's library list are searched until the first match is found.

*CURLIB: The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.

library-name: Specify the name of the library to be searched.

message-queue-name: Specify the name of the message queue.

ACCPTH
Specifies whether the logical file access paths that are dependent on the physical files being saved are also saved. The access paths are saved only in the case of the following:

  • All members on which the access paths are built are included in this save operation.
  • The access paths are not invalid or damaged at the time of the save.

The system checks to ensure the integrity of the access paths. Any discrepancies found by the system will result in the access paths being rebuilt.

Informational messages are sent indicating the number of logical file access paths saved with each physical file. All physical files on which an access path is built must be in the same library. This parameter does not save logical file objects; it controls only the saving of the access paths. More information on the restoring of saved access paths is in the Backup and recovery topic in the Information Center.

Attention!

If the based-on physical files and the logical files are in different libraries, the access paths are saved.

However, if the logical files and the based-on physical files are in different libraries and the logical files or physical files do not exist at restore time (such as during disaster recovery or the files were deleted) the access paths are not restored. They are rebuilt.

For the fastest possible restore operation for logical files, the logical files and the based-on physical files must be in the same library and must be saved at the same time.

*NO: Only objects in the libraries specified on the command are saved. No logical file access paths are saved.

*YES: The physical files in the specified libraries and all eligible logical file access paths over them are saved.

Note: Specifying this value does not save the logical files.

SAVFDTA
Specifies, for save file objects, whether the description of a save file, or both the description and the contents of a save file, are saved.

*YES: The description and contents of the save file are saved.

*NO: Only the description of a save file is saved.

STG
Specifies whether the system storage occupied by the data portion of the specified members (except for save files), modules, programs, service programs, Structured Query Language (SQL) packages, and journal receivers in the library being saved is freed as part of the save operation. Only the data portion of the objects is freed, not the descriptions of the objects.

*KEEP: The storage occupied by the data portion of the objects being saved is not freed.

*FREE: The storage occupied by the data portion of the specified objects being saved is freed as part of the saved operation. The storage for all the objects in a library is freed only after all the objects in that library are saved successfully.

Note: To prevent the possible abnormal end of a program, the program being saved must not be running in the system when *FREE is specified.

DTACPR
Specifies whether data compression is performed.

*DEV: If the tape device has the hardware compression feature installed, processing proceeds as if DTACPR(*YES) is specified. If the compression feature is not installed or if save data is written to a diskette or save file, processing proceeds as if DTACPR(*NO) is specified.

Note: If *DEV is specified on both the DTACPR parameter and the COMPACT parameter, only device data compaction is performed if compaction is supported on the device. Otherwise, data compression is performed if supported on the device.

If *YES is specified on the DTACPR parameter and *DEV is specified on the COMPACT parameter, both device data compaction and device data compression are performed if supported on the device.

*NO: No data compression is done.

*YES: If the save operation is to tape and the target device has the hardware compression feature, hardware compression is done. If the feature is not present, or if the save data is written to optical, diskette, or save file, software data compression is done. If the save operation is being done while other jobs on the system are active and software data compression is used, the overall system performance may be affected.

COMPACT
Specifies whether device data compaction is performed.

*DEV: Device data compaction is performed if the data is saved to tape and all tape devices specified on the DEV parameter support the compaction feature.

Note: If *DEV is specified on both the DTACPR parameter and the COMPACT parameter, only device data compaction is performed if compaction is supported on the device. Otherwise, data compression is performed if supported on the device.

If *YES is specified on the DTACPR parameter and *DEV is specified on the COMPACT parameter, both device data compaction and device data compression are performed if supported on the device.

*NO: Device data compaction is not performed.

OUTPUT
Specifies whether a list of information about the saved libraries is created. The information can be printed with the job's spooled output or directed to a database file.

*NONE: No output listing is created.

*PRINT: The output is printed with the job's spooled output.

*OUTFILE: The output is directed to the database file specified on the OUTFILE parameter.

Note: If OUTPUT(*OUTFILE) is specified, specify the database file name on the OUTFILE parameter.

OUTFILE
Specifies the qualified name of the database file to which the information about the object is directed when *OUTFILE is specified on the OUTPUT parameter. If the file does not exist, this command creates a database file in the specified library. If a new file is created, the system uses QASAVOBJ in QSYS with the format name QSRSAV as a model.

The name of the database file can be qualified by one of the following library values:

*LIBL: All libraries in the job's library list are searched until the first match is found.

*CURLIB: The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.

library-name: Specify the name of the library to be searched.

database-file-name: Specify the name of the database file to which the output of the command is directed.

OUTMBR
Specifies the name of the database file member to which the output is directed when OUTPUT(*OUTFILE) is specified.

Element 1: Member to Receive Output

*FIRST: The first member in the file receives the output. If OUTMBR(*FIRST) is specified and the member does not exist, the system creates a member with the name of the file specified on the OUTFILE parameter.

member-name: Specify the name of the file member that receives the output. If OUTMBR(member-name) is specified and the member does not exist, the system creates it. If the member exists, the user can add records to the end of the existing member or clear the existing member and add the records.

Element 2: Operation to Perform on Member

*REPLACE: The existing records in the specified database file member are replaced by the new records.

*ADD: The new records are added to the existing information in the specified database file member.

INFTYPE
Specifies the type of information which is printed or directed to the database file.

*OBJ: The list contains an entry for each object requested to be saved.

*ERR: The list contains information about the command, an entry for each library, and an entry for each object that was not successfully saved.

*LIB: The list contains library entry for each library requested to be saved.

*MBR: The list contains an entry for each object or, for database files, each member requested to be saved.

OPTFILE
Specifies the path name of the optical file that is used for the save operation, beginning with the root directory of the volume. See path names for more information on specifying path names.

'*': The system generates an optical file name in the root directory of the optical volume.

'optical-directory-path-name/*': The system generates an optical file name in the specified directory of the optical volume.

'optical-file-path-name': Specify the path name of the optical file.

USEOPTBLK
Specifies whether or not the optimum block size is used for the save operation.

*YES: The optimum block size supported by the device is used for Save commands. If the block size that is used is larger than a block size that is supported by all device types then:

  • Performance may improve.
  • The tape file that is created is only compatible with a device that supports the block size used. Commands such as Duplicate Tape (DUPTAP) do not duplicate files unless the files are being duplicated to a device which supports the same block size that was used.
  • The value for the DTACPR parameter is ignored.

If the target release value that is specified is earlier than V3R7M0 then the block size supported by all device types is used.

*NO: The optimum block size supported by the device is not used. Save commands use the default block size supported by all device types. The tape volume can be duplicated to any media format using the Duplicate Tape (DUPTAP) command.

Examples for SAVLIB

Example 1: Saving a Library on a Tape Device

SAVLIB   LIB(JOE)  DEV(TAP01)

This command saves the library named JOE on the tape that is in the tape device named TAP01. The storage occupied by JOE in the system is not freed, because the STG parameter default (*KEEP) was assumed.

Example 2: Saving on Multiple Volumes

SAVLIB   LIB(QGPL)  DEV(DKT01)  VOL(ABC DEF GHI)

The general purpose library (QGPL) is saved on the diskettes in the device named DKT01. The diskettes used must have the volume names ABC, DEF, and GHI. If the save operation is not finished when diskette ABC is full, a message is issued to the operator asking for volume DEF to be placed in the device.

Example 3: Freeing Storage when Saving Data

SAVLIB   LIB(CUSTDATA)  DEV(DKT01)  VOL(CUSTNM CUSTAD)
  STG(*FREE)

The library named CUSTDATA is saved on volumes CUSTNM and CUSTAD, which are put in the diskette device DKT01. The storage occupied by the specified members, modules, programs, service programs, SQL packages, and journal receivers in the CUSTDATA library is freed after it is saved.

Example 4: Saving on Multiple Devices Serially

SAVLIB   LIB(USRLIB)  DEV(TAP01 TAP02 TAP03)
  VOL(USRA USRB USRC USRD)  ENDOPT(*UNLOAD)

The library named USRLIB is saved on four tape volumes on three tape devices. The volume named USRA is put on the device named TAP01, the volume named USRB on the device named TAP02, the volume named USRC on the device named TAP03, and the volume named USRD on the device named TAP01. The volume named USRA is rewound, and must be unloaded by the operator when processing is complete so that the device named TAP01 can be used for the volume named USRD.

Example 5: Saving on Multiple Devices in Parallel

SAVLIB   LIB(USRLIB)  DEV(*MEDDFN)  MEDDFN(LIBA/MEDDFNA)

The library named USRLIB is saved on the devices specified in the media definition named MEDDFNA in library LIBA. For information about creating and using a media definition, see the Backup and recovery topic in the Information Center.

Example 6: Saving a Library with a Media File Label

SAVLIB   LIB(LIB1)  DEV(TAP01)  LABEL(MONDAYBACKUP)

This command uses the tape device named TAP01 to save the library named LIB1 on tape. The library is saved with a media file label of MONDAYBACKUP. This label must be specified when restoring the library or any of its objects.

Example 7: Specifying Where the Save Operation Starts

SAVLIB   LIB(*NONSYS)  DEV(TAP01 TAP02)
  STRLIB(MIKESLIB)

This command saves all user-created libraries, licensed program libraries, and the QGPL & QUSRSYS libraries, beginning with the library named MIKESLIB on tape devices named TAP01 and TAP02. The libraries are saved in alphabetic order. Therefore, all libraries beginning with and following the name MIKESLIB are saved.

Example 8: Saving User Libraries in an Independent ASP Group

SAVLIB   LIB(*ALLUSR)  DEV(TAP01)  ASPDEV(*CURASPGRP)

This command saves all user libraries on the independent ASPs that are in the ASP group for the current thread. It does not save libraries on the system ASP (ASP number 1) or on basic user ASPs (ASP numbers 2-32).

Error messages for SAVLIB

*ESCAPE Messages

CPF3701
&1 objects were saved; &2 objects were not saved.
CPF3703
&2 &1 in &3 not saved.
CPF3708
Save file &1 in &2 too small.
CPF3709
Tape devices do not support same densities.
CPF3727
Duplicate device &1 specified on device name list.
CPF3728
Device &1 specified with other devices.
CPF3730
Not authorized to &2 &1 in library &3.
CPF3731
Cannot use &2 &1 in library &3.
CPF3733
&2 &1 in &3 previously damaged.
CPF3735
Storage limit exceeded for user profile &1.
CPF3738
Device &1 used for save or restore is damaged.
CPF3749
Objects from library &2 not saved.
CPF3751
Some libraries not saved.
CPF3767
Device &1 not found.
CPF3768
Device &1 not valid for command.
CPF377D
Save ended because of read error on internal system resource.
CPF377E
Not enough storage for save-while-active request.
CPF377F
Save-while-active request prevented by pending record changes.
CPF3770
No objects saved or restored for library &1.
CPF3771
&1 objects saved from &3. &2 not saved.
CPF3777
Not all libraries saved.
CPF378A
Message queue not available.
CPF378C
SAVACTMSGQ(*WRKSTN) not valid for batch job.
CPF378E
Library &1 not saved.
CPF3781
Library &1 not found.
CPF3782
File &1 in &2 not a save file.
CPF3785
Not all subsystems ended.
CPF3789
Only one library allowed with specified parameters.
CPF379E
Not enough storage available to save library &1.
CPF3790
No available space on diskette.
CPF3793
Machine storage limit reached.
CPF3794
Save or restore operation ended unsuccessfully.
CPF3797
Objects from library &3 not saved. Save limit exceeded.
CPF380B
Save cannot be completed at this time.
CPF3812
Save file &1 in &2 in use.
CPF3815
Save file &1 in &2 too small for save operation.
CPF3818
Starting library &1 not found.
CPF384E
USEOPTBLK(*YES) not valid for CD-ROM premastering.
CPF3871
No objects saved or restored; &3 objects not included.
CPF3892
&2 &1 in &3 not saved.
CPF3894
Cancel reply received for message &1.
CPF5729
Not able to allocate object &1.
CPF9809
Library &1 cannot be accessed.
CPF9812
File &1 in library &2 not found.
CPF9814
Device &1 not found.>
CPF9820
Not authorized to use library &1.
CPF9822
Not authorized to file &1 in library &2.
CPF9825
Not authorized to device &1.
CPF9833
*CURASPGRP or *ASPGRPPRI specified and thread has no ASP group.>
CPFB8ED
Device description &1 not correct for operation.>
OPT1332
Optical volume not found in device &1.

*STATUS Messages

CPF3770
No objects saved or restored for library &1.
CPF3771
&1 objects saved from &3. &2 not saved.
CPF3871
No objects saved or restored; &3 objects not included.