Class JobOutputReader
- java.lang.Object
-
- java.io.Reader
-
- com.compuware.api.topaz.jes.JobOutputReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
public class JobOutputReader extends Reader
Reads text from a job output or DD for a job, providing for the efficient reading of characters.The entire content of the job/DD will be obtained at the moment the JobOutputReader is constructed and stored in a temporary file. Therefore, any reads done on that
JobOutputReader
object will reflect the content of the dataset at the moment theJobOutputReader
object was constructed, rather than the content of the job/DD at the moment of the read. When close is called, the temporary file will be deleted.The text returned will be in UTF-8 encoding. Non-displayable binary data will be substituted with Unicode characters that are outside of the code page of the mainframe host login. This allows us to distinguish text data from binary within UTF-8.
For efficient reading of job/DD records, it is advisable to wrap a
BufferedReader
around aJobOutputReader
. For example,BufferedReader in = new BufferedReader(new JobOutputReader(...));
Examples:
To read the JES output for a job, use theIJESCommandProvider.findJobs()
API to get aJobInfo
instance for the job. Then create a JobOutputReader for the job.IZOSHostConnection zosHostConnection = ... IJESCommandProvider commandProvider = ... List<IJob> jobs = ... // Create the buffered reader with the appropriate JobInfo IJob iJob = jobs.get(x) BufferedReader in = new BufferedReader(new JobOutputReader(iJob, 200)); //Read the data from the reader String ine; while ((line = in.readLine()) != null) { // Process the line of data }
To read the contents of a DD for a job, use theIJESCommandProvider.fetchSysoutDataDefinitions()
API to get the list of data definitions for a job. Then create a JobOutputReader for the job and DD.IZOSHostConnection zosHostConnection = ... IJESCommandProvider commandProvider = ... List<IJob> jobs = ... List<ISysoutDataDefinition> dds = ... // Create the buffered reader with the appropriate JobInfo IJob iJob = jobs.get(x); ISystemDataDefinition dd = dds.get(x); BufferedReader in = new BufferedReader(new JobOutputReader(iJob, dd, 200)); // Read the data from the reader String line; while ((line = in.readLine()) != null) { // Process the line of data }
- Since:
- 2.2.0
- Version:
- 2.2.0
- See Also:
IJESCommandProvider
,JobInfo
,ISystemDataDefinition
- Restriction:
- This class is not intended to be extended by clients.
-
-
Constructor Summary
Constructors Constructor Description JobOutputReader(IJob iJob, int numberLinesToReturn)
Creates a JobOutputReader that reads all of the output of a job.JobOutputReader(IJob iJob, ISysoutDataDefinition ddDefinition, int numberLinesToReturn)
Creates a JobOutputReader that reads the contents of a specific DD for a job.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
int
read(char[] dataBuffer, int offset, int length)
-
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
JobOutputReader
public JobOutputReader(IJob iJob, int numberLinesToReturn)
Creates a JobOutputReader that reads all of the output of a job.- Parameters:
iJob
- Specifies the job whose output is desired. TheIJob
object is created using the findJobs methods ofcom.compuware.api.topaz.jes.IJesCommandProvider
numberLinesToReturn
- Anint
specifying the maximum number of lines to return. 0 will return all lines.- Throws:
HostIOException
- for any I/O error- See Also:
IJESCommandProvider
-
JobOutputReader
public JobOutputReader(IJob iJob, ISysoutDataDefinition ddDefinition, int numberLinesToReturn)
Creates a JobOutputReader that reads the contents of a specific DD for a job.- Parameters:
iJob
- AIJob
that specifies the job whose output is desired. The IJob object is created using the findJobs methods ofcom.compuware.api.topaz.jes.IJesCommandProvider
ddDefinition
- AISysoutDataDefinition
instance that specifies the DD whose output is desired. The ISysoutDataDefinition is created using the fetchSystemDataDefinitions method ofcom.compuware.api.topaz.jes.IJesCommandProvider
numberLinesToReturn
- Anint
specifying the maximum number of lines to return. 0 will return all lines.- Throws:
HostIOException
- for any I/O error- See Also:
IJESCommandProvider
-
-
Method Detail
-
read
public int read(char[] dataBuffer, int offset, int length) throws IOException
- Specified by:
read
in classReader
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-
-