public class PLIRecord extends java.lang.Object implements IPLIFile
Condition
s for invalid use of this RECORD file type as a STREAM.
Requires access to ecobol.jar in order to function
IPLIFile.Attr
Modifier and Type | Field and Description |
---|---|
static int |
BYTES
size in bytes if converted to a byte array
hint: cannot be converted to a byte array
|
Constructor and Description |
---|
PLIRecord()
PLIRecord constructor tests whether ecobol.jar is accessible
|
PLIRecord(IPLIFile dclFile,
java.lang.String title,
java.lang.String environment,
int lineSize,
int pageSize)
construct a PLIRecord from an IPIFile used to declare the PL/I FILE variable,
and then overridden with non-null other attributes.
|
PLIRecord(java.lang.String ddName,
java.util.EnumSet<IPLIFile.Attr> declareFileAttributes,
java.lang.String title,
java.lang.String environment,
int lineSize,
int pageSize)
PLIRecord constructor tests whether ecobol.jar is accessible
and remembers file options declared on the DCL line.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the file
|
boolean |
delete()
Delete the current record (the last record read)
|
boolean |
delete(byte[] key)
Delete the record identified by the key specified when this file or index was opened,
which could be a primary or alternate key (IDX files).
|
boolean |
deleteByPrimary(byte[] key)
Delete the record identified by the primary /relative record key passed in as a byte array
|
boolean |
deleteFile()
Deletes the file
|
void |
endData()
Finish the GET DATA operation ..
|
java.lang.Object |
getData(java.lang.String name,
java.lang.Object var)
Perform a GET DATA operation (name=value variable retrieval) from an input stream
|
java.lang.String |
getDDName()
Return the DD name for this FILE, which is either the FILE variable or constant name
or an alternate to it specifiec with the TITLE attribute
|
java.util.EnumSet<IPLIFile.Attr> |
getDeclareFileAttributes()
Return the the set of file attributes used on the DCL
|
java.lang.String |
getDSName()
Return the dataset name for this FILE which has been passed as part of the TITLE
attribute or associated with the system property or environment variable associated with its DD name
|
java.lang.String |
getEnvironment()
Return the current environment for the declared file
|
java.util.EnumSet<IPLIFile.Attr> |
getOpenFileAttributes()
Return the the set of file attributes used on the OPEN FILE
|
java.lang.String |
getTitle()
Return the current title for the declared file
|
java.io.InputStream |
inputStream()
Throw an UNDEFINEDFILE CONDITION since PLIRecord files
have the RECORD and not the STREAM
|
boolean |
is(IPLIFile.Attr attr1)
Help determine if a file attribute is set
|
boolean |
isIsnt(IPLIFile.Attr attr1,
IPLIFile.Attr attr2)
Help determine if one of two mutually exclusive alternatives is
or isn't set by checking (first) the open and then (second) declare attributes
|
boolean |
isOpen()
returns whether this file (may be) open.
|
boolean |
isStream()
For PLIRecord FILEs this always returns false
|
byte[] |
keyto()
Return the last key read as a result of a locate(), read() or readPrev()
|
boolean |
locate(byte[] key)
Locate a point within a keyed file, allowing subsequent read()s from that point forward
|
boolean |
open(java.util.EnumSet<IPLIFile.Attr> mode,
java.lang.String title,
java.lang.String environment,
int lineSize,
int pageSize)
Opens the file for read, write, both, extend
|
java.io.OutputStream |
outputStream()
Throw an UNDEFINEDFILE CONDITION since PLIRecord files
have the RECORD and not the STREAM
|
java.io.PrintStream |
printStream()
Throw an UNDEFINEDFILE CONDITION since PLIRecord files
have the RECORD and not the STREAM
|
byte[] |
read()
Read the next record (only if opened not-random)
|
byte[] |
read(byte[] key)
Read a single record with a key
|
byte[] |
readPrev()
Read the previous record (only if opened not-random)
|
boolean |
rewrite(byte[] record)
Rewrite the current record with the data and embedded key
|
boolean |
rewrite(byte[] record,
byte[] key)
Rewrite the record with the given key with the data and embedded key
|
java.util.Scanner |
scanner()
Throw an UNDEFINEDFILE CONDITION since PLIRecord files
have the RECORD and not the STREAM
|
java.lang.String |
toString()
Returns the self-defining information for the debugger
|
boolean |
write(byte[] record)
Write the file with the record and specific relative record number
|
boolean |
write(byte[] record,
byte[] externalKey)
Write the file with the record and specific relative record number
|
boolean |
write(byte[] record,
long rrn)
Write the file with the record and specific relative record number
|
public static final int BYTES
public PLIRecord()
public PLIRecord(java.lang.String ddName, java.util.EnumSet<IPLIFile.Attr> declareFileAttributes, java.lang.String title, java.lang.String environment, int lineSize, int pageSize)
public PLIRecord(IPLIFile dclFile, java.lang.String title, java.lang.String environment, int lineSize, int pageSize)
dclFile
- - the IPIFile used during the declaration that is used
as a basis for constructing a PLIStream with the following overrides:title
- - the FILE TITLE optionenvironment
- - the FILE ENV optionlineSize
- - ignored for RECORD filespageSize
- - ignored for RECORD filespublic boolean is(IPLIFile.Attr attr1)
attr1
- - an attribute to check to see if it is set (cannot be null)public boolean isIsnt(IPLIFile.Attr attr1, IPLIFile.Attr attr2)
attr1
- - an attribute to check to see if it is set (cannot be null)attr2
- - an attribute to check to see if it isn't set (cannot be null)public boolean isStream()
public java.lang.String toString()
toString
in class java.lang.Object
public java.io.PrintStream printStream()
printStream
in interface IPLIFile
public java.io.InputStream inputStream()
inputStream
in interface IPLIFile
public java.io.OutputStream outputStream()
outputStream
in interface IPLIFile
public java.util.Scanner scanner()
public java.lang.Object getData(java.lang.String name, java.lang.Object var)
getData
in interface IPLIFile
name
- - the name or partial name (i.e., part of a Group structure)var
- - the variable to retrieve (Array, Group, Integer, etc.)public void endData()
public java.lang.String getDDName()
public java.lang.String getEnvironment()
getEnvironment
in interface IPLIFile
public java.lang.String getTitle()
public java.lang.String getDSName()
public java.util.EnumSet<IPLIFile.Attr> getDeclareFileAttributes()
getDeclareFileAttributes
in interface IPLIFile
public java.util.EnumSet<IPLIFile.Attr> getOpenFileAttributes()
getOpenFileAttributes
in interface IPLIFile
public boolean open(java.util.EnumSet<IPLIFile.Attr> mode, java.lang.String title, java.lang.String environment, int lineSize, int pageSize)
open
in interface IPLIFile
mode
- an EnumSet of Attrstitle
- - the TITLE attribute or nullenvironment
- - the ENVIRONMENT attribute or nulllineSize
- - the LINESIZE attribute or 0pageSize
- - the PAGESIZE attribute or 0
read sequential disregarding key order; null to read sequentially in orderbykey()
key orderpublic boolean locate(byte[] key)
public byte[] read(byte[] key)
public byte[] read()
public byte[] readPrev()
public byte[] keyto()
public boolean write(byte[] record, long rrn)
public boolean write(byte[] record)
public boolean write(byte[] record, byte[] externalKey)
public boolean rewrite(byte[] record)
public boolean rewrite(byte[] record, byte[] key)
public boolean deleteByPrimary(byte[] key)
deleteByPrimary
in interface IPLIFile
Condition.CONDITION.UNDEFINEDFILE
public boolean delete(byte[] key)
public boolean delete()
public boolean isOpen()
public void close()
public boolean deleteFile()
deleteFile
in interface IPLIFile
Condition.CONDITION.UNDEFINEDFILE
- not declared (w/ MISSINGFILEOPTS)
or CONDITION.UNDEFINEDFILE permissiong denied or file doesn't exist (w/ FILEMISSING)