com.ibm.as400.access
Class SaveFile
- java.lang.Object
-
- com.ibm.as400.access.SaveFile
-
- All Implemented Interfaces:
- java.io.Serializable
public class SaveFile extends java.lang.Object implements java.io.Serializable
Represents a save file on a system.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static int
CLS
Special value for the "waitTime" property.static java.lang.String
CURRENT_RELEASE
Value for the "targetRelease" property, indicating "current release".static int
DEFAULT
Special value for the "maximumNumberOfRecords", "waitTime", and "asp" properties.static int
IMMED
Value for the "waitTime" property, indicating "immediate".static long
NO_MAX
Value for the "maximumNumberOfRecords" property, indicating that the system maximum is used.static java.lang.String
PREVIOUS_RELEASE
Value for the "targetRelease" property, indicating "previous release".
-
Constructor Summary
Constructors Constructor and Description SaveFile(AS400 system, java.lang.String library, java.lang.String name)
Constructs a SaveFile object.
-
Method Summary
Methods Modifier and Type Method and Description void
clear()
Clears all existing records from the save file and reduces the amount of storage used by this file.void
copyTo(java.lang.String library, java.lang.String name)
Copies the save file to another save file on the same system.void
create()
Creates a save file on the system.void
create(long maxRecords, int asp, int waitTime, boolean shared, java.lang.String authority, java.lang.String description)
Creates a save file on the system.void
delete()
Deletes the save file.boolean
equals(java.lang.Object obj)
Determines whether this SaveFile object is equal to another object.boolean
exists()
Determines if the save file currently exists on the system.int
getASP()
Returns the auxiliary storage pool ID for the save file.long
getCurrentNumberOfRecords()
Returns the current number of records in the save file.java.lang.String
getDescription()
Returns the text description of the save file.long
getLength()
Returns the current total size (in bytes) of the save file.java.lang.String
getLibrary()
Returns the name of the library where the save file is located on the system.long
getMaximumNumberOfRecords()
Returns the capacity (maximum number of records) of the save file.java.lang.String
getName()
Returns the name of the save file on the system.ObjectDescription
getObjectDescription()
Returns an ObjectDescription instance representing the save file.java.lang.String
getPath()
Returns the fully-qualifed IFS pathname of the save file.AS400
getSystem()
Returns the system where the save file is located.java.lang.String
getTargetRelease()
Returns the target release level of the operating system on which you intend to restore and use the object(s) saved in the save file by a subsequent invocation of one of the save() methods.int
getWaitTime()
Returns the wait time for the save file.int
hashCode()
Returns a hash code value for the object.boolean
isSaveOutput()
Indicates whether output from called API's will be saved in the job's spooled output.boolean
isShared()
Reports whether the open data path (ODP) for the save file is shared with other programs in the routing step.SaveFileEntry[]
listEntries()
Lists the contents of the save file.Product[]
listProducts()
Lists the product loads in the save file.void
refresh()
Purges any cached attribute information about the save file.void
renameTo(java.lang.String name)
Renames the save file.void
restore(Product product)
Restores a licenced program product that was saved into the save file.void
restore(java.lang.String libraryName)
Restores a library that was saved into the save file.void
restore(java.lang.String libraryName, java.lang.String[] objectList, java.lang.String toLibraryName)
Restores objects that were saved into the save file.void
save(Product product)
Saves a copy of all of the objects that make up a licenced program product, into the save file.void
save(java.lang.String libraryName)
Saves a library into the save file.void
save(java.lang.String[] pathList)
Saves files from the root file system into the save file.void
save(java.lang.String libraryName, java.lang.String[] objectList)
Saves objects into the save file.void
setDescription(java.lang.String description)
Sets the text description of the save file.void
setMaximumNumberOfRecords(long maximumNumberOfRecords)
Sets the capacity (maximum number of records) of the save file.void
setSaveOutput(boolean save)
Indicates whether output from called API's will be saved in the job's spooled output.void
setShared(boolean shared)
Sets whether the open data path (ODP) for the save file is shared with other programs in the routing step.void
setTargetRelease(java.lang.String targetRelease)
Sets the target release level of the operating system on which you intend to restore and use the object(s) saved in the save file by a subsequent invocation of one of the save() methods.void
setWaitTime(int seconds)
Sets the number of seconds to wait for the file resources and session resources to be allocated when the save file is opened, or for the device or session resources to be allocated when an acquire operation is performed to the save file.java.lang.String
toString()
Returns the String representation of this object.
-
-
-
Field Detail
-
CURRENT_RELEASE
public static final java.lang.String CURRENT_RELEASE
Value for the "targetRelease" property, indicating "current release". The object is to be restored to, and used on, the release of the operating system currently running on the system. The object can also be restored to a system with any subsequent release of the operating system installed.- See Also:
- Constant Field Values
-
PREVIOUS_RELEASE
public static final java.lang.String PREVIOUS_RELEASE
Value for the "targetRelease" property, indicating "previous release". 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.- See Also:
- Constant Field Values
-
NO_MAX
public static final long NO_MAX
Value for the "maximumNumberOfRecords" property, indicating that the system maximum is used.- See Also:
- Constant Field Values
-
IMMED
public static final int IMMED
Value for the "waitTime" property, indicating "immediate". The program does not wait; when the file is opened, an immediate allocation of the file resources is required.- See Also:
- Constant Field Values
-
CLS
public static final int CLS
Special value for the "waitTime" property. Indicates that the job default wait time is used as the wait time for the file resources being allocated.- See Also:
- Constant Field Values
-
DEFAULT
public static final int DEFAULT
Special value for the "maximumNumberOfRecords", "waitTime", and "asp" properties. Indicates that the system default value is used.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SaveFile
public SaveFile(AS400 system, java.lang.String library, java.lang.String name)
Constructs a SaveFile object.
Note: This method does not create a save file on the system. To create a save file, usecreate()
orcreate()
.- Parameters:
system
- The system where the save file is located.library
- The library (on the system) where the save file is located. Example: "MYLIB1". Case is preserved.name
- The name of the save file. Example: "MYFILE1". Case is preserved.
-
-
Method Detail
-
clear
public void clear() throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, java.lang.InterruptedException, ObjectDoesNotExistException
Clears all existing records from the save file and reduces the amount of storage used by this file.A save file must be cleared before it can be used again to receive data from a save command or to receive another save file.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
copyTo
public void copyTo(java.lang.String library, java.lang.String name) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Copies the save file to another save file on the same system.
If the target save file doesn't exist on the system, it is created.
If the target save file already contains data, the data is replaced.
If the target exists but is not a save file, this method fails.
If the target has insufficient capacity, an exception is thrown.- Parameters:
library
- The library of the target save file. Example: "MYLIB1". Case is preserved.name
- The name of the target save file. Example: "MYFILE1". Case is preserved.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
create
public void create() throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, java.lang.InterruptedException, ObjectDoesNotExistException, ObjectAlreadyExistsException
Creates a save file on the system.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectAlreadyExistsException
- If the save file already exists on the system.ObjectDoesNotExistException
- If the system API that queries save file description information is missing.
-
create
public void create(long maxRecords, int asp, int waitTime, boolean shared, java.lang.String authority, java.lang.String description) throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, java.lang.InterruptedException, ObjectDoesNotExistException, ObjectAlreadyExistsException
Creates a save file on the system.- Parameters:
maxRecords
- The maximum number of records the save file can hold. IfNO_MAX
is specified, the system maximum is used.asp
- The auxiliary storage pool (ASP) in which the system creates the save file. IfDEFAULT
is specified, the save file is created in the same ASP as the one containing the library holding the file.waitTime
- The number of seconds that the program waits for the file resources and session resources to be allocated when the file is opened, or for the device or session resources to be allocated when an acquire operation is performed to the file. Special values:CLS
,IMMED
shared
- Specifies whether the open data path (ODP) for the save file is shared with other programs in the routing step. When an ODP is shared, the programs accessing the file share facilities such as the file status and the buffer. Default is false.authority
- The authority given to users who do not have specific authority to the save file, who are not on an authorization list, and whose user group has no specific authority to the save file. Defaults to *EXCLUDE if null.description
- The text that briefly describes the save file. Defaults to blank if null.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectAlreadyExistsException
- If the save file already exists on the system.ObjectDoesNotExistException
- If the system API that queries save file description information is missing.
-
delete
public void delete() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, java.lang.InterruptedException
Deletes the save file. If the save file does not exist, does nothing.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
equals
public boolean equals(java.lang.Object obj)
Determines whether this SaveFile object is equal to another object.- Overrides:
equals
in classjava.lang.Object
- Returns:
- true if the two instances are equal
-
hashCode
public int hashCode()
Returns a hash code value for the object.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code value for this object.
-
exists
public boolean exists() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Determines if the save file currently exists on the system.- Returns:
- true if the save file exists; false if the save file does not exist.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the system API that queries save file description information is missing.
-
getASP
public int getASP() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the auxiliary storage pool ID for the save file.
If the save file doesn't exist on the system, an exception is thrown.- Returns:
- The auxiliary storage pool ID.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
getCurrentNumberOfRecords
public long getCurrentNumberOfRecords() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the current number of records in the save file.
If the save file doesn't exist on the system, an exception is thrown.- Returns:
- The current number of records in the save file.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
getDescription
public java.lang.String getDescription() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the text description of the save file.- Returns:
- The text description.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
getLength
public long getLength() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the current total size (in bytes) of the save file.- Returns:
- The size of the save file.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
getLibrary
public java.lang.String getLibrary()
Returns the name of the library where the save file is located on the system.- Returns:
- The name of the library
-
getMaximumNumberOfRecords
public long getMaximumNumberOfRecords() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the capacity (maximum number of records) of the save file. ReturnsNO_MAX
if there is no maximum.
If the save file doesn't exist on the system, an exception is thrown.- Returns:
- The maximum number of records that the save file can hold.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
getName
public java.lang.String getName()
Returns the name of the save file on the system.- Returns:
- The name of the save file
-
getObjectDescription
public ObjectDescription getObjectDescription() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns an ObjectDescription instance representing the save file. Various attributes of the save file can then be queried via the ObjectDescription.- Returns:
- An ObjectDescription representing the save file.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
getPath
public java.lang.String getPath()
Returns the fully-qualifed IFS pathname of the save file. Example: "/QSYS.LIB/MYLIB1.LIB/MYFILE1.SAVF"- Returns:
- The path of the save file.
-
getSystem
public AS400 getSystem()
Returns the system where the save file is located.- Returns:
- The system.
-
getTargetRelease
public java.lang.String getTargetRelease()
Returns the target release level of the operating system on which you intend to restore and use the object(s) saved in the save file by a subsequent invocation of one of the save() methods. The format VxRxMx is used to specify the target 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. Special values includeCURRENT_RELEASE
andPREVIOUS_RELEASE
. The default is CURRENT_RELEASE.
-
getWaitTime
public int getWaitTime() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the wait time for the save file. This is the number of seconds to wait for the file resources and session resources to be allocated when the save file is opened, or for the device or session resources to be allocated when an acquire operation is performed to the save file.
Special values:IMMED
,CLS
If the save file doesn't exist on the system, an exception is thrown.- Returns:
- The wait time.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
isSaveOutput
public boolean isSaveOutput()
Indicates whether output from called API's will be saved in the job's spooled output.
By default, output is not saved.
-
isShared
public boolean isShared() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Reports whether the open data path (ODP) for the save file is shared with other programs in the routing step. When an ODP is shared, the programs accessing the file, share facilities such as the file status and the buffer.
The default is "not shared".
If the save file doesn't exist on the system, an exception is thrown.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
listEntries
public SaveFileEntry[] listEntries() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, java.io.UnsupportedEncodingException
Lists the contents of the save file.
Note: Due to a limitation in the underlying API (QSRLSAVF). files saved from the "root" file system ("/") cannot be listed. Use the DSPSAVF to view the contents of such save files.- Returns:
- The entries in the save file.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.java.io.UnsupportedEncodingException
-
listProducts
public Product[] listProducts() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Lists the product loads in the save file. If the save file contains no product loads, returns an empty list.- Returns:
- The product loads in the save file.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
refresh
public void refresh() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Purges any cached attribute information about the save file.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
renameTo
public void renameTo(java.lang.String name) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Renames the save file. The library is not changed.- Parameters:
name
- The new name for the save file. Example: "MYFILE1".- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
restore
public void restore(java.lang.String libraryName) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Restores a library that was saved into the save file. If the library does not exist, it is created. If the save file does not contain a library named libraryName, an exception is thrown.
Note: This method presents a subset of the functionality of the 'RSTLIB' CL command. For full functionality, call the CL directly using the CommandCall class.- Parameters:
libraryName
- The library to be restored.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
restore
public void restore(java.lang.String libraryName, java.lang.String[] objectList, java.lang.String toLibraryName) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Restores objects that were saved into the save file. If the target library does not exist, it is created. If the save file does not contain the specified library or object, an exception is thrown.
Note: This method presents a subset of the functionality of the 'RSTOBJ' CL command. For full functionality, call the CL directly using the CommandCall class.- Parameters:
libraryName
- The library from which the object was saved.objectList
- The objects to be restored. Objects are specified by simple object name. For example: MYPROG1 or MYFILE2.toLibraryName
- The library to which to restore the object. If null, restores to the original library, that is, the library from which the object was saved.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
restore
public void restore(Product product) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Restores a licenced program product that was saved into the save file. If the save file does not contain the specified product, an exception is thrown.
Note: This method presents a subset of the functionality of the 'RSTLICPGM' CL command. For full functionality, call the CL directly using the CommandCall class.- Parameters:
product
- The product to be restored.- Throws:
AS400Exception
- If the product is already installed, or if the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
save
public void save(java.lang.String libraryName) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Saves a library into the save file. Any existing data in the save file is cleared. If libraryName does not specify an existing library, an exception is thrown.
Note: This method presents a subset of the functionality of the 'SAVLIB' CL command. For full functionality, call the CL directly using the CommandCall class.- Parameters:
libraryName
- The library to be saved.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
save
public void save(java.lang.String libraryName, java.lang.String[] objectList) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Saves objects into the save file. Any existing data in the save file is cleared. If a specified library or object does not exist, an exception is thrown.
Note: This method presents a subset of the functionality of the 'SAVOBJ' CL command. For full functionality, call the CL directly using the CommandCall class.- Parameters:
libraryName
- The library where the object resides.objectList
- The objects to be saved. Objects are specified by simple object name. For example: MYPROG1 or MYFILE2.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
save
public void save(java.lang.String[] pathList) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Saves files from the root file system into the save file. The objects are specified by their fully qualified pathname in the Integrated File System. Wildcard characters ("*") may be used. Any existing data in the save file is cleared. If a specified object does not exist, an exception is thrown.
Note: The objects must all reside in the root file system ("/"). This method will throw an exception if pathList specifies files under QSYS or QDLS.
Note: This method presents a subset of the functionality of the 'SAV' CL command. For full functionality, call the CL directly using the CommandCall class.- Parameters:
pathList
- The objects to be saved; objects are specified by path. For example: "/myDirectory/myFile" or "/myDirectory/*".- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
save
public void save(Product product) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Saves a copy of all of the objects that make up a licenced program product, into the save file. Any existing data in the save file is cleared. If the product does not exist, an exception is thrown.
Note: Depending on the size of the product, this method may take a very long time to complete.
Note: This method presents a subset of the functionality of the 'SAVLICPGM' CL command. For full functionality, call the CL directly using the CommandCall class.- Parameters:
product
- The product to be saved.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
setDescription
public void setDescription(java.lang.String description) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Sets the text description of the save file. If the save file doesn't exist on the system, an exception is thrown.- Parameters:
description
- The description. Maximum length is 50 characters.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
setMaximumNumberOfRecords
public void setMaximumNumberOfRecords(long maximumNumberOfRecords) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Sets the capacity (maximum number of records) of the save file.
If the current number of records in the save file is greater than the new maximumNumberOfRecords value, an exception is thrown, and the save file is not changed.
Special value:NO_MAX
If the save file doesn't exist on the system, an exception is thrown.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
setSaveOutput
public void setSaveOutput(boolean save)
Indicates whether output from called API's will be saved in the job's spooled output. The job will be that of the Remote Command Host Server, job QUSRWRK/QZRCSRVS. The saved information may be useful when analyzing errors.
By default, output is not saved.- Parameters:
save
- Whether output should be saved.
-
setShared
public void setShared(boolean shared) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Sets whether the open data path (ODP) for the save file is shared with other programs in the routing step. When an ODP is shared, the programs accessing the file can share facilities such as the file status and the buffer. For more details refer to the specification of the CHGSAVF CL command in the IBM i reference. If the save file doesn't exist on the system, an exception is thrown.
The default is "not shared".- Parameters:
shared
- Whether ODP is shared.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
setTargetRelease
public void setTargetRelease(java.lang.String targetRelease)
Sets the target release level of the operating system on which you intend to restore and use the object(s) saved in the save file by a subsequent invocation of one of the save() methods. The format VxRxMx is used to specify the target 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.
The object(s) in the save file can be restored to a system with the specified release or with any subsequent release of the operating system installed. Valid values depend on the system's current version, release, and modification level. Special values includeCURRENT_RELEASE
andPREVIOUS_RELEASE
. The default is CURRENT_RELEASE.- Parameters:
targetRelease
- The target release.
-
setWaitTime
public void setWaitTime(int seconds) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Sets the number of seconds to wait for the file resources and session resources to be allocated when the save file is opened, or for the device or session resources to be allocated when an acquire operation is performed to the save file.
The default isIMMED
.
If the save file doesn't exist on the system, an exception is thrown.- Parameters:
seconds
- The wait time.- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
toString
public java.lang.String toString()
Returns the String representation of this object.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The String representation of this object.
-
-