public class JesVsam
extends java.lang.Object
Used by MvsJobSubmitter to submit jobs to the internal reader.
Note: I/O performed using these classes must be performed on a single thread.
| Modifier and Type | Field and Description |
|---|---|
static int |
MODE_BINARY |
static int |
MODE_RECORD |
static int |
MODE_TEXT |
| Constructor and Description |
|---|
JesVsam(java.lang.String ddname,
boolean isWrite)
Create a new instance suitable for handling I/O for the supplied ddname.
|
JesVsam(java.lang.String ddname,
boolean isWrite,
boolean isFixedLength,
int bufferSize)
Create a new instance suitable for handling I/O for the supplied ddname.
|
| Modifier and Type | Method and Description |
|---|---|
int |
advance(int numrecs,
int buflen)
Advance the underlying VSAM file by numrecs from the current position.
|
byte[] |
close()
Flush any buffered records (if write mode) and close the underlying VSAM file.
|
byte[] |
closeWithoutFlush()
Close the underlying VSAM file.
|
void |
flush()
Flushes any pending data in the record buffer into VSAM PUTs.
|
java.lang.String |
getDDName()
Answers the DD name used to open the underlying VSAM file.
|
int |
getLrecl()
Answer the LRECL, which is the maximum record length for variable length files.
|
long |
getRbar()
Answer the RBA of the last record (in the last buffer) read or written.
|
boolean |
isOpen()
Answer true if the file is open, false otherwise.
|
boolean |
isWrite() |
static void |
logDiagnostic(int level,
java.lang.String msg)
Send a message to the native libraries log, which goes to the Language Environment
messages file, which is usually stderr or DD //SYSOUT.
|
void |
point(long rba)
Point to a given RBA before reading.
|
int |
readBuffer(byte[] buffer,
int mode)
Read one or more records into the given buffer
|
long |
readBuffer(byte[] buffer,
int mode,
int maxRecords)
Read one or more records into the given buffer
|
static void |
setLoggingLevel(int level)
Sets the logging level for the Toolkit native code.
|
void |
setLrecl(int lrecl)
Set the LRECL, which is used to control the length of records written (in write mode).
|
void |
write(byte[] record)
Write the supplied bytes as the next sequential record.
|
void |
write(byte[] record,
int offset,
int len)
Write the supplied bytes, starting at offset for len, as the next sequential record.
|
public static final int MODE_RECORD
public static final int MODE_BINARY
public static final int MODE_TEXT
public JesVsam(java.lang.String ddname,
boolean isWrite)
throws java.io.IOException
ddname - the DDisWrite - if true, the DD is opened for write access, read otherwisejava.io.IOException - if a native I/O error occurspublic JesVsam(java.lang.String ddname,
boolean isWrite,
boolean isFixedLength,
int bufferSize)
throws JesVsamException
ddname - the DDisWrite - if true, the DD is opened for write access, read otherwiseisFixedLength - if true, fixed length records are used (only used for write mode)bufferSize - the size of record buffer (only used for write mode)java.io.IOException - if a native I/O error occursJesVsamExceptionpublic byte[] close()
throws JesVsamException
JesVsamExceptionpublic byte[] closeWithoutFlush()
throws JesVsamException
JesVsamExceptionpublic boolean isOpen()
public void flush()
throws JesVsamException
java.io.IOExceptionJesVsamExceptionpublic int getLrecl()
Note: This value may not be accurate for JES3 jobs.
public void setLrecl(int lrecl)
public long getRbar()
throws JesVsamException
JesVsamExceptionpublic java.lang.String getDDName()
public int readBuffer(byte[] buffer,
int mode)
throws JesVsamException
buffer - which is to contain the records, formatted
according to the given mode. MODE_RECORD: each preceded by
a 4 byte big-endian length; MODE_TEXT: each record has
trailing spaces trimmed and is terminated by a newline (x'15);
MODE:BIN: no record separators are present.JesVsamExceptionpublic long readBuffer(byte[] buffer,
int mode,
int maxRecords)
throws JesVsamException
buffer - which is to contain the records, formatted
according to the given mode. MODE_RECORD: each preceded by
a 4 byte big-endian length; MODE_TEXT: each record has
trailing spaces trimmed and is terminated by a newline (x'15);
MODE:BIN: no record separators are present.maxRecords - the maximum number of records to read.JesVsamExceptionpublic void point(long rba)
throws JesVsamException
JesVsamExceptionpublic int advance(int numrecs,
int buflen)
throws JesVsamException
numrecs - the number of records to advancebuflen - the native buffer size to useJesVsamExceptionpublic void write(byte[] record)
throws JesVsamException
isWrite() is false.record - the bytes to write. The length of the byte array must be less
than or equal to the maximum LRECL of the underlying dataset.java.io.IOException - if a native I/O error occursJesVsamExceptionpublic void write(byte[] record,
int offset,
int len)
throws JesVsamException
isWrite() is false.record - the bytes to write.offset - the offset of the first byte in the supplied byte array to write.len - the number of bytes to write. Must be less than or equal to the
maximum LRECL of the underlying dataset.java.io.IOException - if a native I/O error occursJesVsamExceptionpublic boolean isWrite()
public static void logDiagnostic(int level,
java.lang.String msg)
level - one of the LOG_XXX constants defined abovemsg - the message textpublic static void setLoggingLevel(int level)
Alternatively, a system property can be used to set the toolkit logging level. This property has the form: -Djzos.logging={E|W|N|I|D|T}
level - one of the LOG_XXX constants defined abovelogDiagnostic(int, String)