SAVS36F (Save System/36 File)
SAVS36F Command syntax diagram
Purpose
The Save System/36 File (SAVS36F) command saves the following:
- A copy of a single database physical or logical file to diskette, tape or another database physical file in the same format as if a System/36 had saved the file.
- A copy of multiple database physical or logical files to diskette or tape in the same format as if a System/36 had saved the files as a Save All Set. The following groups of files can be saved together with one operation:
- All files in a library
- All files in a specific file group
- All files that are not part of a file group
- All files that begin with a specified set of characters
A Save All Set is a group (set) of files that share the same group (set) name and that are saved (copied) to diskette or tape with one operation. The set of files can be restored (copied back from diskette or tape) with a single operation by referring to the set name (see the Restore System/36 Files (RSTS36F) command).
File groups are defined by file names that contain a period. The characters preceding the period identify the file group, and the characters following the period identify the file within the group. As with file names within the System/36 environment, the maximum number of characters is eight, including the period. Files with names that do not contain a period are not part of a file group. The following examples show the names of files within a file group.
PAYROL.A PAYROL.B Files in File Group PAYROL PAYROL.C A.ACCTS A.INV A.PROL Files in File Group A A.B.GO A.B.INV A.B.GO A.B.INV Files in File Group A.BThe saved files can be restored to the following systems:
- System/36 (RESTORE procedure or $COPY utility)
- iSeries 400 (Restore System/36 File (RSTS36F) command)
The SAVS36F command is intended for exchanging files with a System/36. For creating a backup version of a file, the iSeries 400 save commands (for example, Save Object (SAVOBJ) or Save Changed Object (SAVCHGOBJ)) should be used.
Restrictions
- The following authorities are required (normally only applies when running on a system using resource security):
- *USE authority for this command.
- *USE authority for the file or group of files specified in the FROMFILE parameter.
- *USE authority for the library specified in the FROMLIB parameter.
- *CHANGE authority to the file specified on the PHYFILE parameter if saving to an existing physical file.
- *USE authority for the library specified in the PHYFILE parameter if saving to a physical file.
- *CHANGE authority for the library specified in the PHYFILE parameter if saving to a physical file and the file does not exist.
- *USE authority for the diskette device description object, *USE authority for device file QSYSDKT, in library QSYS if saving to diskette.
- *USE authority for the tape device description object, *USE authority for device file QSYSTAP, in library QSYS if saving to tape.
- *USE authority for the based-on physical file if saving a logical file.
- All diskettes that are used for the save operation should be initialized using the INZDKT CL command or the equivalent System/36 environment function (INIT operator control language (OCL) procedure or $INIT SSP utility). For a two-sided diskette, use a sector size of 256 or 1024. For a one-sided diskette, use a sector size of 128 or 512. If tape is used, each tape volume used should have been initialized with standard labels using the INZTAP CL command or the equivalent System/36 environment function (TAPEINIT OCL procedure or $TINIT SSP utility). Use a density of 1600 bits per inch when initializing the tape.
Note: If the tape or diskette has not been initialized as stated above, the System/36 will not be able to process the media. - Object-level and record-level functions, other than read operations, should not be attempted for a file being saved by SAVS36F. Concurrent activity against the file (for example, moving the file or adding or removing records) can cause:
- For a save operation of a single file (FROMFILE(file-name)), the save operation will end with escape message CPF9826 because the file cannot be allocated.
- For a save operation of multiple files (FROMFILE(*ALL or generic*-file-name)), the save function sends an inquiry message CPA2C6A because the file cannot be allocated. The message allows an ignore, retry and cancel response. The ignore response bypasses this file and attempts to save the next file selected.
- When saving a single file to diskette, the diskette cannot already contain an active file with the same label and creation date as the new file to be created.
- When saving multiple files to diskette, the diskette used for the save cannot contain any active files.
- Not all physical and logical files can be saved with the SAVS36F command.
- Only logical files created under the System/36 environment (for example, through the BLDINDEX OCL procedure) or through a DDM request from a System/36 system can be saved. These files are saved as System/36 alternative index files.
- All physical files created under the System/36 environment (for example, through the BLDFILE OCL procedure) or through a DDM request from a System/36 system are saved using information stored within the iSeries 400 file description. These files are saved as System/36 sequential, direct, or indexed physical files.
- Any physical files created by iSeries 400 commands or utilities can be saved as long as the record length is not greater than 4096. These files are saved as System/36 sequential files.
- To generate a save format which can be processed by the System/36 RESTORE procedure, the following information is not saved:
- If saving a logical file, only the description of the file is saved. The index (or access path) is not saved.
- If saving an indexed (keyed) physical file, the data is saved but the index is not. The index will be rebuilt after the file is restored.
- The following restrictions apply to naming standards:
- When saving a single file, the specified name (FROMFILE parameter) must meet naming standards. If not, message CPF0001 is sent when the SAVS36F command is processed.
- If a file name is found during a save operation of multiple files (FROMFILE(*ALL or generic*-file-name)) that does not meet the System/36 naming standards, diagnostic message CPF2C0E is sent and the file is not saved.
- Multiple files (FROMFILE(*ALL) or FROMFILE(generic*-name)) cannot be saved to a physical file.
Required Parameters
- FROMFILE
- Specifies the name of one or more files to save. The files being saved must be in the library specified in the FROMLIB parameter.
*ALL: All files in the specified library are saved. The GROUP parameter is used to further describe which files are saved.
generic*-file-name: Specify the generic name of the file. 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 names, refer to generic names.
file-name: Specify the name of a single file to save.
- FROMLIB
- Specifies which library contains the database files to be saved.
- DEV
- Specifies the names of the devices used for the save operation. Each device name other than *PHYFILE must already be known on the system by a device description.
*PHYFILE: Specifies a database physical file is to receive the copied file. The qualified name of the physical files must be specified on the PHYFILE parameter.
*PHYFILE is not valid when saving multiple files by specifying *ALL or generic*-file-name on the FROMFILE parameter.
If the physical file does not exist, it is created as a non-keyed, program-described file with a record length of 256. If a file already exists by this name, it is used as long as it is a non-keyed physical file with a record length of 256.
The copied records are put in the first member of the physical file. If the file has no members, a member is created using the name syntax 'Myymmdd' and the system date (for example, if the SAVS36F was run on June 28, 1987, the member name would be M870628).
device-name: Specify the name of the diskette device, the media library device, or the names of tape devices that are used for the operation. If more than one tape device is used, specify the names of the devices in the order in which they are used. When more than one tape volume is used, using more than one tape device permits one tape volume to be rewound or unloaded while another tape device processes the next tape volume. More information on device names is in the APPC, APPN, and HPR topic in the Information Center.
Optional Parameters
- GROUP
- Specify which file groups are to be saved. This parameter is only valid if *ALL is specified for the FROMFILE parameter.
*ALL: All files are saved.
*NONE: Only files that do not belong to a file group are saved.
group-name: Specify the name of a file group to be saved. Do not specify either the period (.), which indicates a file name, or the file name itself. For example, to save files belonging to the file group that includes PAYROL.A, PAYROL.B, and PAYROL.C, enter PAYROL for this parameter. Files that do not belong to the specified file group are not saved. A group-name can be up to seven characters long. The first character in the name must begin with an alphabetic character (A through Z, #, @ or $). The remaining characters can be any combination of characters (numeric, alphabetic and special). Commas(,), apostrophes('), quotation marks("), question mark(?), asterisks(*), and blanks are not allowed.
- SET
- Specify the set identifier used to identify the entire set of files to be saved. This parameter is only valid if *ALL or a generic-name is specified on the FROMFILE parameter.
#SAVE: The files are saved as a Save All Set with a set identifier of #SAVE.
set-identifier: Specify the set identifier that is used to identify the entire set of file to be saved. Valid values range from 1 through 8 characters in length. The first character in the name must begin with an alphabetic character (A through Z, #, @ or $). The remaining characters can be any combination of characters (numeric, alphabetic and special). Commas(,), apostrophes('), quotation marks("), question marks(?), asterisks(*), and blanks are not allowed.
- TOLABEL
- Specifies the label given to the new tape or diskette file created by the save of a single file.
The TOLABEL name is also put into the System/36 file descriptor record which is stored at the beginning of the tape or diskette file. When the file is restored on a System/36, its name is the TOLABEL value (unless it is overridden by a //FILE OCL statement). Up to 8 characters can be used for the label.
If no value is specified, the value of the FROMFILE parameter is used as the diskette or tape label. If the FROMFILE parameter is an extended name, the characters between the quotation marks are used as the label. For example, specifying FROMFILE("MIKE&BOB") and no TOLABEL parameter would be the same as specifying TOLABEL('MIKE&BOB').
Note: This parameter cannot be specified if *ALL or generic*-name is specified on the FROMFILE parameter. The name of each file saved is used for the diskette or tape file label. If the name of the file is an extended name, the characters between the quotation marks are used as the label. For example, if the name of the file being saved is "A+B," the name of the diskette or tape file would be A+B.
- CRTDATE
- Specifies, for a date-differentiated file (maintained by the System/36 environment), which instance (member) of the file is saved. The default is to save the last instance (most recently created member) of the specified file. The date must be typed in the job date format (DATFMT). If separators, specified by the job date separator value (DATSEP), are used, the value must be enclosed in apostrophes. This parameter is valid only if a database physical file is being saved.
*LAST: The most recently created member for the specified file is saved.
*ALL: All members in the date-differentiated file are saved. If the file being saved is not date-differentiated, only the last member created in the file is saved. *ALL is valid only when saving multiple files and either *ALL or a generic file name is specified on the FROMFILE parameter.
file-creation-date: Specify the creation date of the date-differentiated file member to be saved. A file creation date can only be specified if a single file is to be saved and a file-name is specified on the FROMFILE parameter. (The date must be entered in the job date format (DATFMT); if separators, specified by the job date separator value (DATSEP), are used, the value must be enclosed in apostrophes.)
The date specified is converted to year/month/day format and the member of the file (specified by the FILE parameter) with the name 'Myymmdd' is saved. For example, to save the instance of file 'FRED' created on July 10, 1986, specify FROMFILE(FRED) CRTDATE('07/10/86'), which would save member M860710 in file FRED.
This example allows a migrated System/36 user to identify the desired file/member very much like a System/36. However, it does not lend itself to letting the user save off a single member from an iSeries 400 system multi-member file. For example, the user who has a file named FRED with members BOB and JOE could not pick which member should be saved (the user would have to copy the member to a new file and save the new file specifying CRTDATE(*LAST) or rename the member to follow the 'Myymmdd' name syntax).
- SEQNBR
- Specifies, only when tape is used, which sequence number is used for the save operation.
*END: The system saves the specified file 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. If the sequence number to be assigned to the specified file is greater than 9999, an error message is issued and the operation ends. If multiple files are to be saved, the next file is saved to a file after the first file saved, and so on. If the sequence number to be assigned ever exceeds 9999, an error message is issued and the operation ends.
file-sequence-number: Specify the sequence number of the file that is used. Valid values range from 1 through 9999.
If this sequence number already exists on the tape volume, the tape label at that sequence number must match the TOLABEL parameter. The existing file at that sequence number is overwritten, and all subsequent files on the volume are not accessible after the save.
If a new tape file is added to the tape, the sequence number must be one higher than the sequence number of the last tape file on that volume. No gaps are allowed in the series of sequence numbers.
If multiple files are being saved, this sequence number is used for the first file. All remaining files are saved as if *END was specified on the parameter SEQNBR. If the sequence number to be assigned ever exceeds 9999, an error message is issued and the operation ends.
- 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 file to be saved is copied on whatever volume is on the device. For diskettes, use whatever volume is loaded in the diskette drive. If the diskette loaded in the diskette drive is full of active files, the save ends.
volume-identifier: Specify the volume identifiers of the tapes or diskettes used for saving the file. For each tape or diskette volume name, up to six characters can be specified using any combination of letters and numbers. The user should ensure that the volume name meets the System/36 volume identifier requirements. Up to 50 volume identifiers can be specified.
- RETAIN
- Specifies the retention period for the newly created tape or diskette file. The file is protected and cannot be written over until the day after the retention period ends.
1: The default retention period is one day.
retention-period: Specify the number of days the tape or diskette file should be kept. Valid values range from 0 through 999. If a retention period of 999 is specified, the tape or diskette file becomes a permanent file.
- ENDOPT
- Specifies the operation that is automatically performed on the tape volume after the operation ends. If more than one volume is included, this parameter applies only to the last tape volume used; all other tape volumes are rewound and unloaded when the end of the tape is reached.
Note: This parameter is ignored if a diskette device is specified in the DEV parameter. *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.
- PHYFILE
- Specifies the qualified name of the file that receives the copied source file member data. This parameter is required if DEV(*PHYFILE) is specified.
If a file by this name does not exist, it is created as a non-keyed, program-described physical file with a record length of 256 bytes. If a file already exists by this name, it is used as long as it is a non-keyed physical file with a record length of 256 bytes.
The copied records are put in the first member of the physical file. If the file has no members, a member is created using the name syntax 'Myymmdd' and the system date. For example, if the SAVS36LIBM was run on June 28, 1987, the member name would be M870628.
The name of the physical 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.
file-name: Specify the name of the physical file.
- DTACPR
- Specifies, when a diskette is used, whether the data is compressed into System/36 compatible format before it is written to the diskette. If the save command is operating while other jobs on the system are active and data compression is used, the overall system performance may be affected. This parameter is not valid if *PHYFILE or a tape device is specified on the DEV parameter.
*NO: The data is not compressed before being written to the diskette.
*YES: The data is compressed before being written to the diskette.
- MBROPT
- Specifies whether the new records replace or are added to the existing records.
*NOREPLACE: If a file already exists by the name specified on the PHYFILE parameter in the specified library, an error message is sent and the data in that member is not replaced.
*REPLACE: The system clears the existing member and adds the new records.
Examples for SAVS36F
Example 1: Saving a Single File
SAVS36F FROMFILE(PETE) FROMLIB(QS36F) DEV(I1)This command saves the file named PETE located in library QS36F. Assuming that I1 is the name of a diskette device description, the file is saved on the diskette placed in the diskette drive. The diskette file label is PETE (same as the FROMFILE name). If PETE is a date-differentiated physical file, the most recently created instance (member) of PETE is saved. The diskette file has a retention period of one day (the retention period ends at midnight of the following day).
Example 2: Saving a Single File
SAVS36F FROMFILE(MSTRPAY) FROMLIB(PAYLIB) DEV(T1 T2) TOLABEL('PAY.MSTR') RETAIN(999)The file named MSTRPAY located in library PAYLIB is saved. Assuming that T1 and T2 are tape devices, the file is copied to the tapes on devices T1 and T2. The tape file label is PAY.MSTR and the tape file is a permanent file. The last tape used for the save is rewound at the end of the save operation.
Example 3: Saving Multiple Files
SAVS36F FROMFILE(*ALL) FROMLIB(QS36F) DEV(T1 T2) GROUP(*ALL) SET(ALLFL) RETAIN(999)All database physical and logical files in library QS36F (including all files that belong to a file group) are saved. If any of the files are date-differentiated files, only the last member created in each file is saved. Assuming that T1 and T2 are tape devices, the files are copied to the tape volumes that are placed in tape drives T1 and T2. The label of the tape files created are the same as the names of the files that are saved. The first tape file created is located after the last sequence number on the tape. The remaining files are located after that first file. The tape files created are permanent. The last tape used for the save is rewound at the end of the save operation. The set identifier associated with this save all set is ALLFL.
Example 4: Saving Multiple Files
SAVS36F FROMFILE(*ALL) FROMLIB(QS36F) DEV(T1 T2) GROUP(*NONE) CRTDATE(*LAST) SET(NOGFL) RETAIN(999)All database physical and logical files in library QS36F except those files that belong to a file group are saved. If any of the files are date-differentiated files, only the last member created in each file is saved. Assuming that T1 and T2 are tape devices, the files are copied to the tape volumes that are placed in tape drives T1 and T2. The label of the tape files created is the same as the names of the files that are saved. The first tape file created is located after the last sequence number on the tape. The remaining files are located after that first file. The tape files created are permanent. The last tape used for the save is rewound at the end of the save operation. The set identifier associated with this save all set is NOGFL.
Example 5: Saving Multiple Files
SAVS36F FROMFILE(*ALL) FROMLIB(GRPLIB) DEV(I1) GROUP(GRP) CRTDATE(*ALL)All database physical and logical files in library GRPLIB that belong to file group GRP (GRP.01, GRP.02, and so on) are saved. If any of the files are date-differentiated files, all members in the files are saved. Assuming that I1 is a diskette drive, the files are copied to the diskette that is placed in the diskette drive. The label of the diskette files created is the same as the names of the files that are saved. The diskette files expire after one day. The set identifier associated with this save all set is #SAVE.
Example 6: Saving Multiple Files
SAVS36F FROMFILE(PAY*) FROMLIB(PAYROLL) DEV(I1) SET(PAYSET) CRTDATE(*LAST) VOL(PAYDKT) RETAIN(10)All database physical and logical files in library PAYROLL whose names begin with the characters PAY (PAY.01, PAYRATE, and so on) are saved. If any of the files are date-differentiated files, only the last member created is saved. Assuming that I1 is a diskette drive, the files are copied to a diskette with a volume identifier of PAYDKT. The label of the diskette files created is the same as the names of the files that are saved. The diskette files expire after ten days. The set identifier associated with this save all set is PAYSET.
Additional Considerations
A status message (CPI2C11) is sent when the processing begins for each database physical file that is saved. A completion message (CPC2C14 or CPC2C15) is sent after each file has been successfully saved.
Saving a Single File
A single file can be saved by specifying the name of the file on the FROMFILE parameter. If the file has multiple members (date-differentiated file), the user can:
- Specify which instance of the file (member) is to be saved by specifying the file's creation date on the CRTDATE parameter.
- Specify that the most recently created file (last member) is to be saved by specifying *LAST on the CRTDATE parameter.
Note: *ALL cannot be specified on the CRTDATE parameter to save all instances of the file (all members) when saving a single file. If the file is being saved to diskette or tape, the TOLABEL parameter can be used to specify the label of the new diskette or tape file created during the save operation. The label is also used when the file is restored.
If a single file is to be saved and a problem occurs that will not allow the operation to continue, an escape message is sent to the program message queue previous to the command processing program (CPP). This escape message informs the user of the cause and recovery of the problem. The message ends the operation.
Saving Multiple Files
Multiple files can be saved by specifying one of the following on the FROMFILE parameter:
- *ALL specifies the following:
- If the value on the GROUP parameter is *ALL, all physical and logical files in the specified library (FROMLIB parameter) are saved, including all files that are part of file groups.
- If the value on the GROUP parameter is *NONE, all physical and logical files in the specified library (FROMLIB parameter) are saved, except those files that are part of file groups.
- If the value on the GROUP parameter is a file group name, all physical and logical files in the specified library (FROMLIB parameter) that are part of the specified file group are saved.
- generic*-file-name specifies that all physical and logical files in the specified library (FROMLIB parameter) with the same prefix as the generic name are saved.
When saving multiple files, a set identifier (SET parameter) is required. If a value is not specified, #SAVE is used.
The TOLABEL parameter cannot be specified. The label of the diskette or tape file created will be the same as the database file that is copied into it.
A specific file creation date cannot be specified on the CRTDATE parameter. If the file has multiple members (date-differentiated file), the most recently created member (CRTDATE(*LAST)) or all members (CRTDATE(*ALL)) can be saved.
If multiple files are to be saved and a problem is found that will not allow the operation to continue for a particular file, an inquiry message will be sent. If the SAVS36F job is interactive, the message is sent to the work station where the job was submitted. If the job is batch, the message is sent to the QSYSOPR message queue. The inquiry message informs the user of the cause and recovery of the problem. The messages have the following response options:
- C-Cancel the save operation.
- R-Retry saving the file after the problem has been corrected.
- I-Ignore saving this file and continue with the save of the next file.
The default response is I.
If multiple files are to be saved, and the operation was successful for all selected files, a completion message (CPC2C19) is sent after all files have been saved. This completion message informs the user the number of files that were saved. If any of the selected files cannot be saved, an escape message (CPF2C5B) is sent at the end of the save operation. The message informs the user of the number of files that were saved and the number that were not saved.
Error messages for SAVS36F
*ESCAPE Messages
- CPF2C4A
- Device &1 not correct for command.
- CPF2C4B
- Duplicate device &1 specified in device name list.
- CPF2C4C
- Diskette device &1 included in multiple device specification.
- CPF2C4F
- Diskette format not correct for DTACPR(*YES).
- CPF2C47
- Existing file &1 or member &3 in library &2 not replaced.
- CPF2C48
- Input file &1 in &2 not correct for command.
- CPF2C49
- Output file &1 in &2 not correct for command.
- CPF2C5B
- Not all files were saved.
- CPF2C5C
- Save operation ended before all files were saved.
- CPF2C5D
- No files saved from library &1.
- CPF2C5E
- Input file &1 in &2 not correct for command.
- CPF2C5F
- Tape file sequence numbers beyond 9999 not allowed.
- CPF2C50
- File description for file &1 is not available.
- CPF2C51
- Member information for file &1 in library &2 is not available.
- CPF2C52
- Error occurred during attempt to create file &1 in library &2.
- CPF2C54
- FROMFILE name &1 too long to use for TOLABEL parameter.
- CPF2C55
- TOLABEL parameter value &1 contains embedded blank(s).
- CPF2C56
- Physical file name &1 too long.
- CPF2C58
- Diskette format not acceptable for System/36.
- CPF2C59
- FROMFILE name &1 too long.
- CPF9810
- Library &1 not found.
- 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.
- CPF9826
- Cannot allocate file &2.
- CPF9830
- Cannot assign library &1.
- CPF9831
- Cannot assign device &1.
- CPF9845
- Error occurred while opening file &1.
- CPF9847
- Error occurred while closing file &1 in library &2.
- CPF9848
- Cannot open file &1 in library &2 member &3.
- CPF9849
- Error while processing file &1 in library &2 member &3.