com.ibm.jtopenlite.command.program
Class OpenListOfJobs
java.lang.Object
com.ibm.jtopenlite.command.program.ProgramAdapter
com.ibm.jtopenlite.command.program.OpenListOfJobs
- All Implemented Interfaces:
- Program
public class OpenListOfJobs
- extends ProgramAdapter
QGYOLJOB
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();
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
OpenListOfJobs
public OpenListOfJobs(OpenListOfJobsFormat format,
int lengthOfReceiverVariable,
int numberOfRecordsToReturn,
int[] fieldsToReturn)
getKeyFields
public OpenListOfJobsKeyField[] getKeyFields()
getListInformation
public ListInformation getListInformation()
getSortListener
public OpenListOfJobsSortListener getSortListener()
setSortListener
public void setSortListener(OpenListOfJobsSortListener sortListener)
getResetStatusStatistics
public boolean getResetStatusStatistics()
setResetStatusStatistics
public void setResetStatusStatistics(boolean resetStatusStatistics)
getElapsedTime
public long getElapsedTime()
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)