com.ibm.jtopenlite.command.program.workmgmt
Class OpenListOfJobs
- java.lang.Object
-
- com.ibm.jtopenlite.command.program.workmgmt.OpenListOfJobs
-
- All Implemented Interfaces:
- Program, OpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
public class OpenListOfJobs extends java.lang.Object implements OpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
Use the QGYOLJOB API to access the list of job on the IBM i. This class fully implements the V5R4 specification of QGYOLJOB.Example:
CommandConnection conn = CommandConnection.getConnection(...); OpenListOfJobsFormatOLJB0200 jobFormat = new OpenListOfJobsFormatOLJB0200(); // Use the OLJB0200 format to get key info back. int receiverSize = 100; // This should be large enough for the initial call. int numRecordsToReturn = 1; // Need to return at least one record to get the key definition back. int[] fieldsToReturn = new int[] { 1906 }; // Subsystem information. OpenListOfJobs jobList = new OpenListOfJobs(jobFormat, receiverSize, numRecordsToReturn, fieldsToReturn); OpenListOfJobsSelectionListener jobSelector = ...; // Define your own. Optional. jobList.setSelectionListener(jobSelector, OpenListOfJobs.SELECTION_OLJS0100); OpenListOfJobsSortListener jobSorter = ...; // Define your own. Optional. jobList.setSortListener(jobSorter); CommandResult result = conn.call(jobList); // Assuming it succeeded... OpenListOfJobsKeyField[] keyDefinitions = jobList.getKeyFields(); ListInformation listInfo = jobList.getListInformation(); byte[] requestHandle = listInfo.getRequestHandle(); int recordLength = listInfo.getRecordLength(); // Now, the list is building on the server. // Call GetListEntries once to wait for the list to finish building, for example. receiverSize = 100; // Should be good enough for the first call. numRecordsToReturn = 0; int startingRecord = -1; // Wait until whole list is built before returning. Optional. GetListEntries getJobs = new GetListEntries(receiverSize, requestHandle, recordLength, numRecordsToReturn, startingRecord, jobFormat); result = conn.call(getJobs); // Assuming it succeeded... listInfo = getJobs.getListInformation(); int totalRecords = listInfo.getTotalRecords(); // Now retrieve the job records in chunks of, for example, 300 at a time. numRecordsToReturn = 300; receiverSize = recordLength * numRecordsToReturn; startingRecord = 1; getJobs.setLengthOfReceiverVariable(receiverSize); getJobs.setNumberOfRecordsToReturn(numRecordsToReturn); getJobs.setStartingRecord(startingRecord); jobFormat.setKeyFields(keyDefinitions); OpenListOfJobsFormatOLJB0200Listener callback = ...; // Define your own. jobFormat.setListener(callback); // Ready to process. while (startingRecord <= totalRecords) { result = conn.call(getJobs); // Assuming it succeeded... listInfo = getJobs.getListInformation(); startingRecord += listInfo.getRecordsReturned(); getJobs.setStartingRecord(startingRecord); } // All done. CloseList close = new CloseList(requestHandle); result = conn.call(close); conn.close();
-
-
Field Summary
Fields Modifier and Type Field and Description static int
SELECTION_OLJS0100
static int
SELECTION_OLJS0200
-
Constructor Summary
Constructors Constructor and Description OpenListOfJobs()
OpenListOfJobs(OpenListOfJobsFormat format, int lengthOfReceiverVariable, int numberOfRecordsToReturn, int[] fieldsToReturn)
-
Method Summary
Methods Modifier and Type Method and Description long
getElapsedTime()
int[]
getFieldsToReturn()
OpenListOfJobsFormatListener
getFormatListener()
The format listener gets called by the formatter once the output data has been formatted.OpenListOfJobsFormat
getFormatter()
The formatter is the class that handles formatting the output data for each entry in the list.OpenListOfJobsKeyField[]
getKeyFields()
int
getLengthOfReceiverVariable()
ListInformation
getListInformation()
int
getNumberOfParameters()
Returns the number of parameters for this program.int
getNumberOfRecordsToReturn()
byte[]
getParameterInputData(int parmIndex)
Returns the input data of the parameter at the specified index.int
getParameterInputLength(int parmIndex)
Returns the input length of the parameter at the specified index.int
getParameterOutputLength(int parmIndex)
Returns the output length of the parameter at the specified index.int
getParameterType(int parmIndex)
Returns the type of parameter at the specified index.java.lang.String
getProgramLibrary()
Returns the library of the program object.java.lang.String
getProgramName()
Returns the name of the program object.boolean
getResetStatusStatistics()
OpenListOfJobsSelectionListener
getSelectionListener()
OpenListOfJobsSortListener
getSortListener()
byte[]
getTempDataBuffer()
The implementor can create their own temp byte array for the output parameter size and reuse it each time a call is performed, or for more than one parameter on the same call.void
newCall()
Invoked before any other methods on this interface by CommandConnection whenever this Program is called.void
setFieldsToReturn(int[] fieldsToReturn)
void
setFormatListener(OpenListOfJobsFormatListener listener)
void
setFormatter(OpenListOfJobsFormat formatter)
void
setLengthOfReceiverVariable(int length)
void
setNumberOfRecordsToReturn(int numberOfRecordsToReturn)
void
setParameterOutputData(int parmIndex, byte[] data, int maxLength)
Sets the output data for the parameter at the specified index.void
setResetStatusStatistics(boolean resetStatusStatistics)
void
setSelectionListener(OpenListOfJobsSelectionListener selectionListener, int selectionFormat)
void
setSortListener(OpenListOfJobsSortListener sortListener)
-
-
-
Field Detail
-
SELECTION_OLJS0100
public static final int SELECTION_OLJS0100
- See Also:
- Constant Field Values
-
SELECTION_OLJS0200
public static final int SELECTION_OLJS0200
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OpenListOfJobs
public OpenListOfJobs()
-
OpenListOfJobs
public OpenListOfJobs(OpenListOfJobsFormat format, int lengthOfReceiverVariable, int numberOfRecordsToReturn, int[] fieldsToReturn)
-
-
Method Detail
-
getTempDataBuffer
public final byte[] getTempDataBuffer()
Description copied from interface:Program
The implementor can create their own temp byte array for the output parameter size and reuse it each time a call is performed, or for more than one parameter on the same call. The implementor can choose to ignore this, and simply return null. The command connection checks to see if the buffer returned by this method is not null and large enough to accommodate the output parameter size.- Specified by:
getTempDataBuffer
in interfaceProgram
-
getFormatter
public OpenListOfJobsFormat getFormatter()
Description copied from interface:OpenListProgram
The formatter is the class that handles formatting the output data for each entry in the list.- Specified by:
getFormatter
in interfaceOpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
-
setFormatter
public void setFormatter(OpenListOfJobsFormat formatter)
- Specified by:
setFormatter
in interfaceOpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
-
getFormatListener
public OpenListOfJobsFormatListener getFormatListener()
Description copied from interface:OpenListProgram
The format listener gets called by the formatter once the output data has been formatted.- Specified by:
getFormatListener
in interfaceOpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
-
setFormatListener
public void setFormatListener(OpenListOfJobsFormatListener listener)
- Specified by:
setFormatListener
in interfaceOpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
-
getProgramName
public java.lang.String getProgramName()
Description copied from interface:Program
Returns the name of the program object.- Specified by:
getProgramName
in interfaceProgram
-
getProgramLibrary
public java.lang.String getProgramLibrary()
Description copied from interface:Program
Returns the library of the program object.- Specified by:
getProgramLibrary
in interfaceProgram
-
newCall
public void newCall()
Description copied from interface:Program
Invoked before any other methods on this interface by CommandConnection whenever this Program is called.
-
getKeyFields
public OpenListOfJobsKeyField[] getKeyFields()
-
getListInformation
public ListInformation getListInformation()
- Specified by:
getListInformation
in interfaceOpenListProgram<OpenListOfJobsFormat,OpenListOfJobsFormatListener>
-
getNumberOfParameters
public int getNumberOfParameters()
Description copied from interface:Program
Returns the number of parameters for this program.- Specified by:
getNumberOfParameters
in interfaceProgram
-
getSortListener
public OpenListOfJobsSortListener getSortListener()
-
setSortListener
public void setSortListener(OpenListOfJobsSortListener sortListener)
-
getResetStatusStatistics
public boolean getResetStatusStatistics()
-
setResetStatusStatistics
public void setResetStatusStatistics(boolean resetStatusStatistics)
-
getElapsedTime
public long getElapsedTime()
-
getLengthOfReceiverVariable
public int getLengthOfReceiverVariable()
-
setLengthOfReceiverVariable
public void setLengthOfReceiverVariable(int length)
-
getNumberOfRecordsToReturn
public int getNumberOfRecordsToReturn()
-
setNumberOfRecordsToReturn
public void setNumberOfRecordsToReturn(int numberOfRecordsToReturn)
-
getFieldsToReturn
public int[] getFieldsToReturn()
-
setFieldsToReturn
public void setFieldsToReturn(int[] fieldsToReturn)
-
getSelectionListener
public OpenListOfJobsSelectionListener getSelectionListener()
-
setSelectionListener
public void setSelectionListener(OpenListOfJobsSelectionListener selectionListener, int selectionFormat)
-
getParameterInputLength
public int getParameterInputLength(int parmIndex)
Description copied from interface:Program
Returns the input length of the parameter at the specified index.- Specified by:
getParameterInputLength
in interfaceProgram
-
getParameterOutputLength
public int getParameterOutputLength(int parmIndex)
Description copied from interface:Program
Returns the output length of the parameter at the specified index.- Specified by:
getParameterOutputLength
in interfaceProgram
-
getParameterType
public int getParameterType(int parmIndex)
Description copied from interface:Program
Returns the type of parameter at the specified index.- Specified by:
getParameterType
in interfaceProgram
- See Also:
Parameter
-
getParameterInputData
public byte[] getParameterInputData(int parmIndex)
Description copied from interface:Program
Returns the input data of the parameter at the specified index.- Specified by:
getParameterInputData
in interfaceProgram
-
setParameterOutputData
public void setParameterOutputData(int parmIndex, byte[] data, int maxLength)
Description copied from interface:Program
Sets the output data for the parameter at the specified index.- Specified by:
setParameterOutputData
in interfaceProgram
-
-