com.ibm.as400.access.list
Class SpooledFileOpenList

java.lang.Object
  |
  +--com.ibm.as400.access.list.OpenList
        |
        +--com.ibm.as400.access.list.SpooledFileOpenList
All Implemented Interfaces:
java.io.Serializable

public class SpooledFileOpenList
extends OpenList

An OpenList implementation that generates lists of SpooledFileListItem objects.

   AS400 system = new AS400("mySystem", "myUserID", "myPassword");
   SpooledFileOpenList list = new SpooledFileOpenList(system);
   list.setFilterUsers(new String[] { "*CURRENT" }); // Get all of myUserID's spooled files.
   list.addSortField(SpooledFileOpenList.JOB_NUMBER, true); // Sort the list by job number in ascending order.
   list.open();
   Enumeration enum = list.getItems();
   while (enum.hasMoreElements())
   {
     SpooledFileListItem item = (SpooledFileListItem)enum.nextElement();
     System.out.println(item.getJobName()+"/"+item.getJobUser()+"/"+item.getJobNumber()+" - "+item.getName()+", "+item.getNumber());
   }
   list.close();
 

See Also:
Serialized Form

Field Summary
static int ASP
          Sorting constant used to sort the list of spooled files by auxiliary storage pool (ASP).
static int COPIES_LEFT_TO_PRINT
          Sorting constant used to sort the list of spooled files by number of copies left to print.
static int CURRENT_PAGE
          Sorting constant used to sort the list of spooled files by current page number.
static int DATE_OPENED
          Sorting constant used to sort the list of spooled files by date.
static int DEVICE_TYPE
          Sorting constant used to sort the list of spooled files by device type.
static int FORM_TYPE
          Sorting constant used to sort the list of spooled files by form type.
static java.lang.String FORMAT_0100
          Constant indicating that this list will accept parameters for, and, generate SpooledFileListItem objects in accordance with, the OSPL0100 format of the underlying API.
static java.lang.String FORMAT_0200
          Constant indicating that this list will accept parameters for, and, generate SpooledFileListItem objects in accordance with, the OSPL0200 format of the underlying API.
static java.lang.String FORMAT_0300
          Constant indicating that this list will accept parameters for, and, generate SpooledFileListItem objects in accordance with, the OSPL0300 format of the underlying API.
static int JOB_NAME
          Sorting constant used to sort the list of spooled files by the job name portion of the job information.
static int JOB_NUMBER
          Sorting constant used to sort the list of spooled files by the job number portion of the job information.
static int JOB_SYSTEM
          Sorting constant used to sort the list of spooled files by system.
static int JOB_USER
          Sorting constant used to sort the list of spooled files by the user name portion of the job information.
static int NAME
          Sorting constant used to sort the list of spooled files by spooled file name.
static int NUMBER
          Sorting constant used to sort the list of spooled files by spooled file number.
static int OUTPUT_QUEUE_LIBRARY
          Sorting constant used to sort the list of spooled files by output queue library.
static int OUTPUT_QUEUE_NAME
          Sorting constant used to sort the list of spooled files by output queue name.
static int PRINTER_ASSIGNED
          Sorting constant used to sort the list of spooled files by printer assignment.
static int PRINTER_NAME
          Sorting constant used to sort the list of spooled files by printer name.
static int PRIORITY
          Sorting constant used to sort the list of spooled files by priority.
static int SCHEDULE
          Sorting constant used to sort the list of spooled files by schedule.
static int SIZE
          Sorting constant used to sort the list of spooled files by size.
static int STATUS
          Sorting constant used to sort the list of spooled files by status.
static int TIME_OPENED
          Sorting constant used to sort the list of spooled files by time.
static int TOTAL_PAGES
          Sorting constant used to sort the list of spooled files by total number of pages.
static int USER_DATA
          Sorting constant used to sort the list of spooled files by user data.
 
Fields inherited from class com.ibm.as400.access.list.OpenList
EMPTY_ERROR_CODE_PARM, system_
 
Constructor Summary
SpooledFileOpenList(AS400 system)
          Constructs a SpooledFileOpenList object with the given system.
SpooledFileOpenList(AS400 system, java.lang.String format)
          Constructs a SpooledFileOpenList object with the given system and format.
 
Method Summary
 void addSortField(int field, boolean ascending)
          Adds a field on which to sort the list when it is built.
protected  byte[] callOpenListAPI()
          Calls QGY/QGYOLSPL.
 void clearSortFields()
          Clears all sorting information for this list.
protected  java.lang.Object[] formatOutputData(byte[] data, int recordsReturned, int recordLength)
          Formats the data from QGY/QGYOLSPL using format OSPL0300.
protected  int getBestGuessReceiverSize(int number)
          Returns 100 plus (136*number).
 java.util.Date getFilterCreationDateEnd()
          Returns the end creation date being used to filter the list of spooled files.
 java.util.Date getFilterCreationDateStart()
          Returns the start creation date being used to filter the list of spooled files.
 java.lang.String[] getFilterDevices()
          Returns the printer device names being used to filter the list of spooled files.
 java.lang.String getFilterFormType()
          Returns the form type being used to filter the list of spooled files.
 java.lang.String getFilterJobName()
          Returns the job name portion of the job information used to determine which spooled files belong in the list.
 java.lang.String getFilterJobNumber()
          Returns the job number portion of the job information used to determine which spooled files belong in the list.
 java.lang.String getFilterJobSystemName()
          Returns the job system name used to determine which spooled files belong in the list.
 java.lang.String getFilterJobUser()
          Returns the user name portion of the job information used to determine which spooled files belong in the list.
 java.lang.String[] getFilterOutputQueues()
          Returns the output queue names being used to filter the list of spooled files.
 java.lang.String[] getFilterStatuses()
          Returns the statuses being used to filter the list of spooled files.
 java.lang.String getFilterUserData()
          Returns the user data being used to filter the list of spooled files.
 java.lang.String[] getFilterUsers()
          Returns the user names being used to filter the list of spooled files.
 java.lang.String getFormat()
          Returns the format currently in use by this open list.
 void setFilterCreationDate(java.util.Date start, java.util.Date end)
          Sets the creation date range used to filter the list of spooled files.
 void setFilterDevices(java.lang.String[] devices)
          Sets the printer device names used to filter the list of spooled files.
 void setFilterFormType(java.lang.String formType)
          Sets the form type used to filter the list of spooled files.
 void setFilterJobInformation(java.lang.String jobName, java.lang.String jobUser, java.lang.String jobNumber)
          Sets the qualified job information used to filter the list of spooled files.
 void setFilterJobSystemName(java.lang.String systemName)
          Sets the job system name used to filter the list of spooled files.
 void setFilterOutputQueues(java.lang.String[] queues)
          Sets the output queues used to filter the list of spooled files.
 void setFilterStatuses(java.lang.String[] statuses)
          Sets the statuses used to filter the list of spooled files.
 void setFilterUserData(java.lang.String userData)
          Sets the user data used to filter the list of spooled files.
 void setFilterUsers(java.lang.String[] users)
          Sets the user names used to filter the list of spooled files.
 void setFormat(java.lang.String format)
          Sets the format this list will use on the next call to open().
 
Methods inherited from class com.ibm.as400.access.list.OpenList
close, finalize, getEnumerationBlockSize, getItems, getItems, getLength, getSystem, isOpen, open, resetHandle, setEnumerationBlockSize
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT_0100

public static final java.lang.String FORMAT_0100
Constant indicating that this list will accept parameters for, and, generate SpooledFileListItem objects in accordance with, the OSPL0100 format of the underlying API.

See Also:
setFormat(java.lang.String), Constant Field Values

FORMAT_0200

public static final java.lang.String FORMAT_0200
Constant indicating that this list will accept parameters for, and, generate SpooledFileListItem objects in accordance with, the OSPL0200 format of the underlying API.

See Also:
setFormat(java.lang.String), Constant Field Values

FORMAT_0300

public static final java.lang.String FORMAT_0300
Constant indicating that this list will accept parameters for, and, generate SpooledFileListItem objects in accordance with, the OSPL0300 format of the underlying API. This is the default format.

See Also:
setFormat(java.lang.String), Constant Field Values

JOB_NAME

public static final int JOB_NAME
Sorting constant used to sort the list of spooled files by the job name portion of the job information.

See Also:
addSortField(int, boolean), Constant Field Values

JOB_USER

public static final int JOB_USER
Sorting constant used to sort the list of spooled files by the user name portion of the job information.

See Also:
addSortField(int, boolean), Constant Field Values

JOB_NUMBER

public static final int JOB_NUMBER
Sorting constant used to sort the list of spooled files by the job number portion of the job information.

See Also:
addSortField(int, boolean), Constant Field Values

NAME

public static final int NAME
Sorting constant used to sort the list of spooled files by spooled file name.

See Also:
addSortField(int, boolean), Constant Field Values

NUMBER

public static final int NUMBER
Sorting constant used to sort the list of spooled files by spooled file number.

See Also:
addSortField(int, boolean), Constant Field Values

STATUS

public static final int STATUS
Sorting constant used to sort the list of spooled files by status.

See Also:
addSortField(int, boolean), Constant Field Values

DATE_OPENED

public static final int DATE_OPENED
Sorting constant used to sort the list of spooled files by date.

See Also:
addSortField(int, boolean), Constant Field Values

TIME_OPENED

public static final int TIME_OPENED
Sorting constant used to sort the list of spooled files by time.

See Also:
addSortField(int, boolean), Constant Field Values

SCHEDULE

public static final int SCHEDULE
Sorting constant used to sort the list of spooled files by schedule.

See Also:
addSortField(int, boolean), Constant Field Values

JOB_SYSTEM

public static final int JOB_SYSTEM
Sorting constant used to sort the list of spooled files by system.

See Also:
addSortField(int, boolean), Constant Field Values

USER_DATA

public static final int USER_DATA
Sorting constant used to sort the list of spooled files by user data.

See Also:
addSortField(int, boolean), Constant Field Values

FORM_TYPE

public static final int FORM_TYPE
Sorting constant used to sort the list of spooled files by form type.

See Also:
addSortField(int, boolean), Constant Field Values

OUTPUT_QUEUE_NAME

public static final int OUTPUT_QUEUE_NAME
Sorting constant used to sort the list of spooled files by output queue name.

See Also:
addSortField(int, boolean), Constant Field Values

OUTPUT_QUEUE_LIBRARY

public static final int OUTPUT_QUEUE_LIBRARY
Sorting constant used to sort the list of spooled files by output queue library.

See Also:
addSortField(int, boolean), Constant Field Values

ASP

public static final int ASP
Sorting constant used to sort the list of spooled files by auxiliary storage pool (ASP).

See Also:
addSortField(int, boolean), Constant Field Values

SIZE

public static final int SIZE
Sorting constant used to sort the list of spooled files by size.

See Also:
addSortField(int, boolean), Constant Field Values

TOTAL_PAGES

public static final int TOTAL_PAGES
Sorting constant used to sort the list of spooled files by total number of pages.

See Also:
addSortField(int, boolean), Constant Field Values

COPIES_LEFT_TO_PRINT

public static final int COPIES_LEFT_TO_PRINT
Sorting constant used to sort the list of spooled files by number of copies left to print.

See Also:
addSortField(int, boolean), Constant Field Values

PRIORITY

public static final int PRIORITY
Sorting constant used to sort the list of spooled files by priority.

See Also:
addSortField(int, boolean), Constant Field Values

PRINTER_NAME

public static final int PRINTER_NAME
Sorting constant used to sort the list of spooled files by printer name. This is only valid for FORMAT_0200.

See Also:
addSortField(int, boolean), Constant Field Values

PRINTER_ASSIGNED

public static final int PRINTER_ASSIGNED
Sorting constant used to sort the list of spooled files by printer assignment. This is only valid for FORMAT_0200.

See Also:
addSortField(int, boolean), Constant Field Values

CURRENT_PAGE

public static final int CURRENT_PAGE
Sorting constant used to sort the list of spooled files by current page number. This is only valid for FORMAT_0100 and FORMAT_0200.

See Also:
addSortField(int, boolean), Constant Field Values

DEVICE_TYPE

public static final int DEVICE_TYPE
Sorting constant used to sort the list of spooled files by device type. This is only valid for FORMAT_0100 and FORMAT_0200.

See Also:
addSortField(int, boolean), Constant Field Values
Constructor Detail

SpooledFileOpenList

public SpooledFileOpenList(AS400 system)
Constructs a SpooledFileOpenList object with the given system. By default, this list will generate a list of SpooledFileListItem objects for all spooled files on the system using the default format of FORMAT_0300.

Parameters:
system - The system.

SpooledFileOpenList

public SpooledFileOpenList(AS400 system,
                           java.lang.String format)
Constructs a SpooledFileOpenList object with the given system and format. By default, this list will generate a list of SpooledFileListItem objects for all spooled files on the system.

Parameters:
system - The system.
format - The format.
See Also:
setFormat(java.lang.String)
Method Detail

addSortField

public void addSortField(int field,
                         boolean ascending)
Adds a field on which to sort the list when it is built. Use one of the sort constants on this class. By default, no sorting is done.

Parameters:
field - The field used to sort the list.
ascending - true to sort in ascending order on this field (e.g. A-Z or 0-9); false for descending.

callOpenListAPI

protected byte[] callOpenListAPI()
                          throws AS400Exception,
                                 AS400SecurityException,
                                 ErrorCompletingRequestException,
                                 java.lang.InterruptedException,
                                 java.io.IOException,
                                 ObjectDoesNotExistException
Calls QGY/QGYOLSPL.

Specified by:
callOpenListAPI in class OpenList
Returns:
The output data from the list information parameter in the call to the QGY API.
AS400Exception
AS400SecurityException
ErrorCompletingRequestException
java.lang.InterruptedException
java.io.IOException
ObjectDoesNotExistException

clearSortFields

public void clearSortFields()
Clears all sorting information for this list. No sorting will be done when the list is generated unless addSortField() is called to specify which fields to sort on.


formatOutputData

protected java.lang.Object[] formatOutputData(byte[] data,
                                              int recordsReturned,
                                              int recordLength)
                                       throws AS400Exception,
                                              AS400SecurityException,
                                              ErrorCompletingRequestException,
                                              java.lang.InterruptedException,
                                              java.io.IOException,
                                              ObjectDoesNotExistException
Formats the data from QGY/QGYOLSPL using format OSPL0300.

Specified by:
formatOutputData in class OpenList
Parameters:
data - The output data from the receiver variable from the call to the QGYGTLE (Get List Entries) API.
recordsReturned - The number of records returned, as reported in the open list information returned on the call to QGYGTLE.
recordLength - The length of a record, in bytes, as reported in the open list information returned on the call to QGYGTLE.
AS400Exception
AS400SecurityException
ErrorCompletingRequestException
java.lang.InterruptedException
java.io.IOException
ObjectDoesNotExistException

getBestGuessReceiverSize

protected int getBestGuessReceiverSize(int number)
Returns 100 plus (136*number).

Specified by:
getBestGuessReceiverSize in class OpenList
Parameters:
number - The number of records in the list on the server. This is useful if the subclass needs to return a receiver size based on how many records are in the list.
Returns:
The number of bytes to allocate for the receiver variable when the QGYGTLE (Get List Entries) API is called. This number does not have to be calculated exactly, as QGYGTLE will be called repeatedly until the correct size is known. This number is just for the initial call to QGYGTLE. Too low of a value may result in extra API calls, too high of a value may result in wasted bytes being sent and received.

getFilterCreationDateEnd

public java.util.Date getFilterCreationDateEnd()
Returns the end creation date being used to filter the list of spooled files.

Returns:
The end creation date, or null if the end creation date used will be the latest date in the list.
See Also:
getFilterCreationDateStart()

getFilterCreationDateStart

public java.util.Date getFilterCreationDateStart()
Returns the start creation date being used to filter the list of spooled files.

Returns:
The start creation date, or null if the start creation date used will be the earliest date in the list.
See Also:
getFilterCreationDateEnd()

getFilterDevices

public java.lang.String[] getFilterDevices()
Returns the printer device names being used to filter the list of spooled files.

Returns:
The array of printer device names, or null if the list is not being filtered by device.

getFilterFormType

public java.lang.String getFilterFormType()
Returns the form type being used to filter the list of spooled files.

Returns:
The form type, or null if the list is not being filtered by form type.

getFilterJobName

public java.lang.String getFilterJobName()
Returns the job name portion of the job information used to determine which spooled files belong in the list.

Returns:
The job name, or "" to indicate any job name.
See Also:
setFilterJobInformation(java.lang.String, java.lang.String, java.lang.String)

getFilterJobNumber

public java.lang.String getFilterJobNumber()
Returns the job number portion of the job information used to determine which spooled files belong in the list.

Returns:
The job number, or "" to indicate any job number.
See Also:
setFilterJobInformation(java.lang.String, java.lang.String, java.lang.String)

getFilterJobSystemName

public java.lang.String getFilterJobSystemName()
Returns the job system name used to determine which spooled files belong in the list.

Returns:
The job system name, "*CURRENT" for the current system, or the default of "*ALL" to indicate the list is not being filtered by job system name. Note that the job system name filter is only used when connecting to servers running OS/400 V5R2 and higher.
See Also:
setFilterJobSystemName(java.lang.String)

getFilterJobUser

public java.lang.String getFilterJobUser()
Returns the user name portion of the job information used to determine which spooled files belong in the list.

Returns:
The user name, or "" to indicate any user name.
See Also:
setFilterJobInformation(java.lang.String, java.lang.String, java.lang.String)

getFilterOutputQueues

public java.lang.String[] getFilterOutputQueues()
Returns the output queue names being used to filter the list of spooled files.

Returns:
The array of fully-qualified integrated file system path names of output queues, or null if the list is not being filtered by output queue.

getFilterStatuses

public java.lang.String[] getFilterStatuses()
Returns the statuses being used to filter the list of spooled files.

Returns:
The array of statuses, or null if the list is not being filtered by status.

getFilterUserData

public java.lang.String getFilterUserData()
Returns the user data being used to filter the list of spooled files.

Returns:
The user data, or null if the list is not being filtered by user data.

getFilterUsers

public java.lang.String[] getFilterUsers()
Returns the user names being used to filter the list of spooled files.

Returns:
The array of user names, or null if the list is not being filtered by user name.

getFormat

public java.lang.String getFormat()
Returns the format currently in use by this open list. Possible values are:

Returns:
The format. The default format is FORMAT_0300.

setFilterCreationDate

public void setFilterCreationDate(java.util.Date start,
                                  java.util.Date end)
Sets the creation date range used to filter the list of spooled files. By default, the list is not filtered by creation date. Note that the creation date filter is only used when connecting to servers running OS/400 V5R2 and higher.

Parameters:
start - The start date. All spooled files with a creation date and time equal to or later than the start date will be selected. Specify null to indicate that the earliest creation date and later will be selected, up to the specified end date.
end - The end date. All spooled files with a creation date and time equal to or earlier than the end date will be selected. Specify null to indicate that the latest creation date and earlier will be selected, down to the specified start date.
See Also:
getFilterCreationDateStart(), getFilterCreationDateEnd()

setFilterDevices

public void setFilterDevices(java.lang.String[] devices)
Sets the printer device names used to filter the list of spooled files.

Parameters:
devices - The array of printer device names. Only spooled files that belong to the specified printer devices are returned in the list. Specify null to clear the status filter, so that spooled files in the list are no longer filtered based on device.

setFilterFormType

public void setFilterFormType(java.lang.String formType)
Sets the form type used to filter the list of spooled files.

Parameters:
formType - The form type. Only spooled files whose form type matches the specified form type are returned in the list. Specify "*STD" for the standard form type. Specify null to clear the form type filter, so that spooled files in the list are no longer filtered based on form type.

setFilterJobInformation

public void setFilterJobInformation(java.lang.String jobName,
                                    java.lang.String jobUser,
                                    java.lang.String jobNumber)
Sets the qualified job information used to filter the list of spooled files. Specifying null for a parameter resets it to its default value of blank. Blank is only valid for a parameter if all three parameters are specified as blank, or the jobName parameter is specified as "*".

Parameters:
jobName - The job name of the job whose spooled files are to be included in the list. Specify "*" for the current job. If "*" is specified, the jobUser and jobNumber parameters are automatically set to blank.
jobUser - The user name of the job whose spooled files are to be included in the list.
jobNumber - The job number of the job whose spooled files are to be included in the list.
See Also:
getFilterJobName(), getFilterJobUser(), getFilterJobNumber()

setFilterJobSystemName

public void setFilterJobSystemName(java.lang.String systemName)
Sets the job system name used to filter the list of spooled files. Specifying null resets it to its default value of "*ALL". Note that the job system name filter is only used when connecting to servers running OS/400 V5R2 and higher.

Parameters:
systemName - Only spooled files created on systemNamewill be included in the list. Specify "*CURRENT" to return only spooled files created on the current system.
See Also:
getFilterJobSystemName()

setFilterOutputQueues

public void setFilterOutputQueues(java.lang.String[] queues)
Sets the output queues used to filter the list of spooled files.

Parameters:
queues - An array of fully-qualified integrated file system path names of output queues. Only spooled files that reside in the specified output queues are returned in the list. Specify null to clear the output queue filter, so that the spooled files in the list are no longer filtered based on output queue.

setFilterStatuses

public void setFilterStatuses(java.lang.String[] statuses)
Sets the statuses used to filter the list of spooled files. Possible status values are:

Parameters:
statuses - The array of statuses. Only spooled files whose status matches one of the specified statuses are returned in the list. Specify null to clear the status filter, so that spooled files in the list are no longer filtered based on status.

setFilterUserData

public void setFilterUserData(java.lang.String userData)
Sets the user data used to filter the list of spooled files.

Parameters:
userData - The user data. Only spooled files whose user data exactly matches the specified user data are returned in the list. Specify null to clear the user data filter, so that spooled files in the list are no longer filtered based on user data.

setFilterUsers

public void setFilterUsers(java.lang.String[] users)
Sets the user names used to filter the list of spooled files.

Parameters:
users - An array of user names. Only spooled files that were created by the specified users are returned in the list. Specify "*CURRENT" as one of the users to mean the current user profile. Specify null to clear the user filter, so that the spooled files in the list are no longer filtered based on user name.

setFormat

public void setFormat(java.lang.String format)
Sets the format this list will use on the next call to open(). Any SpooledFileListItems generated by this list will have attributes associated with the specified format. The default format is FORMAT_0300.

Parameters:
format - The format. Possible values are:
  • FORMAT_0100 - This is faster than FORMAT_0200.
  • FORMAT_0200 - This is faster than FORMAT_0300.
  • FORMAT_0300 - This causes the list to be built slower, but returns the most useful information.