Package com.softwaremining.files
Class AbstractSequentialFile
java.lang.Object
com.softwaremining.wrappers.CBLBean
com.softwaremining.wrappers.AbstractBasePersistence
com.softwaremining.files.AbstractFile
com.softwaremining.files.AbstractSequentialFile
- All Implemented Interfaces:
IPersistence
,AbstractDataObject
,ICBLBeanNGroup
,ICBLContainer
,IFieldContainer
,ISMBean
,ISMDataType
- Direct Known Subclasses:
SequentialFile
,SequentialNIOFile
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
static final int
the following variables are used in Sequential file generation.protected boolean
protected int
protected int
protected int
Number of lines used for Cr / FL.protected int
static final int
protected static final int
protected byte[]
protected boolean
protected boolean
Variable records have to be LINE-SEQUENTIAL (use NewLine as delimitor)
fixedLengthRecords are usually RECORD-SEQUENTIAL.protected boolean
Variable records have to be LINE-SEQUENTGIAL
fixedLengthRecords are RECORD-SEQUENTIALprotected boolean
static final int
protected MInteger
lineCounter keeps track of lines in sequential file, as per ANSI COBOL standardprotected long
Used internally by SoftwareMining libraries In UNISYS, after opening the file, the system can get an estimate of how many records there are available.static final int
protected static NumericFormatBinary
protected static final int
protected static final byte[]
protected AbstractCBLNumeric
For ARRAY-FIELD OCCURS DEPENDING ON INTEGER-FIELD; The list contains reference to INTEGER-FIELD.protected boolean
ADVANCE PAGE for printer files will insert "\f" character.static final int
for ILE COBOL : WRITE PRINTLINE AFTER ADVANCING TO-TOP-OF-PAGEstatic long
for internal use only ...protected boolean
Used to indicate if this class uses Record Descriptor WordFields inherited from class com.softwaremining.files.AbstractFile
openMode
Fields inherited from class com.softwaremining.wrappers.AbstractBasePersistence
fileName, ownerClassName, status
Fields inherited from class com.softwaremining.wrappers.CBLBean
EBCDIC_JIT_PD_SUPPORT_FOR_SEQ_FILES, INDEX_FOR_NON_ARRAY_VERSION_OF_FIELD, INDEX_ZERO, log, tmp_lengthofAssignedValue, totalRuntime_allocate, totalRuntime_calcFieldOffsets, totalRuntime_getMemoryPosition, totalRuntime_setFieldFormatted
Fields inherited from interface com.softwaremining.sql.IPersistence
ACCESS_MODE_DYNAMIC, ACCESS_MODE_RANDOM, ACCESS_MODE_SEQUENTIAL, ASCENDING_RECORD_KEY, CONDITION_TYPE_EQUALS, CONDITION_TYPE_GREATER, CONDITION_TYPE_GREATER_OR_EQUALS, CONDITION_TYPE_IGNORE, CONDITION_TYPE_IGNORE_FOR_SQL_LIKE, CONDITION_TYPE_LESS, CONDITION_TYPE_LESS_OR_EQUALS, CONDITION_TYPE_LIKE, CONDITION_TYPE_NO_CONDITION, CONDITION_TYPE_NOT_ASSIGNED, DESCENDING_RECORD_KEY, OPEN_MODE_EXTEND, OPEN_MODE_I_O, OPEN_MODE_INPUT, OPEN_MODE_NOT_OPENED, OPEN_MODE_OUTPUT, STATUS_AT_END, STATUS_DUP_KEY, STATUS_FAILED_CLOSING, STATUS_INCORRECT_READ_OF_UNOPENED_FILE, STATUS_INCORRECT_RECORDSIZE_REWRITE, STATUS_INSERT_ERR_INAPPROPRIATE_FILE, STATUS_INSERT_ERR_INVALID_KEY, STATUS_LOCK, STATUS_NOT_FOUND, STATUS_REWRITE_WITHOUT_READ, STATUS_SM_FAIL_UNKOWN_REASON, STATUS_SM_NOT_ASSIGNED, STATUS_SUCCESS, UNCERTAIN_OF_RETURN_VALUE
-
Constructor Summary
ConstructorsConstructorDescriptiondefault Constructordefault Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract int
_insertRecord
(int groupSize) Used Internally by SoftwareMining Framework Insert (write) the current data into file.final void
advance
(int advanceType, int size) SUPPORT FOR WRITE XYZ AFTER ADVANCING PAGE myFile.advance( LINE , 12); // where 12 represents the number of lines to advance myFile.write();final void
advance
(int advanceType, long size) SUPPORT FOR WRITE XYZ AFTER ADVANCING PAGE - e.g.final void
advance
(int advanceType, BigDecimal size) SUPPORT FOR WRITE XYZ AFTER ADVANCING PAGE - e.g.final void
assignDependingField
(AbstractCBLNumeric dependingField) Information here is only used in sequentialFilesprotected void
assignEncodedBytes
(byte[] finalBytes) void
assignFileName
(String fileName) In Sequential File Processing - it overwrites the default name of an input/output file automatically assigned by the system.void
assignFixedLenghtRecordsEndWithNewLine
(boolean fixedLenghtRecordsEndWithNewLine) Only affects SequentialFile - NOT SequentialNIO Files (they are always terminted with CR-LF
Fixed length records are treated as SEQUENTIAL files - they do not use NEWLINE character(s) as record delimiter
Setting this flag to true will add new-line character to end of each fixed-length record.final void
assignRecordsAreFixedLength
(boolean fixedLengthRecord) Sequential files can be LINE-SEQUENTIAL or RECORD-SEQUENIAL
false: system assumes LINE-SEQUENIAL (different length records separated by CR-LF)
true: system assumes RECORD-SEQUENTIAL (records of fixed size concatenated together)
NOTE: fixedLengthRecord (SEQUENTIAL FILES) can be forced to use a NEWLINE as delimiter through method assignFixedLenghtRecordsEndWithNewLineprotected final void
assignRecordSize
(int newValue) for internal use onlyvoid
assignTargetIsPrinter
(boolean targetIsPrinter) ADVANCE PAGE for printer files will insert "\f" character.void
assignUsesRDW
(boolean usesRDW) Indicates if this class uses Record Descriptor Wordfinal void
implementation of sequentialFile CLOSE xxx REEL.int
deletes the entire fileboolean
exists()
check if data file existsfinal int
show how many CRLF character are used (Windows 2 - unix 1).protected final int
return the storage size of the recordfinal int
insert
(AbstractCBLField field) Insert a record - populate the values from the existing fieldsint
Insert (write) the current data into file.final int
insertRecord
(AbstractCBLField field) Insert (write) the current data into file.abstract boolean
supporting UNISYS IF ATTRIBUTE OPEN OF record = VALUE TRUEprotected boolean
fixedLengthRecords are treated as SEQUENTIAL, ie records are concatenated together.boolean
isRDW()
Indicates if this class uses Record Descriptor Wordint
read the next record from file.protected abstract int
for internal SoftwareMining useprotected abstract int
for internal SoftwareMining useabstract int
open
(int openMode, boolean prefixFileNameWithCallingProgram) int
Scroll back to previous record When end (or beginning) of file is reached, it throws AtEndExceptionprotected abstract int
final void
Utility method used in creating log filesint
read()
Same as next() .
Reads the next record from file.int
read the next record from file.int
An utility method used to provide an indication on current position in the data file.protected String
final MInteger
final MInteger
final int
final long
In UNISYS, after opening the file, the system can get an estimate of how many records there are available.final int
returns the current number of pages inserted into this filefinal AbstractCBLNumeric
final void
setCRLFcharCount
(int CRLFcharCount) set new values for CRFL count (unix uses 1, Windows 2)Methods inherited from class com.softwaremining.files.AbstractFile
resetDataDirectory, retrieveDataDirectory, retrieveFullFileName, retrieveOpenMode
Methods inherited from class com.softwaremining.wrappers.AbstractBasePersistence
assignAccessMode, assignLock, assignStatus, assignStatus, assignStatusAsPrimitive, assignStatusValue, assignStatusValue, assignTableName, clear, close, delete, insert, next, open, prev, readRow, retrieveAccessMode, retrieveFileName, retrieveFileName, retrieveFirstLevelEntry, retrieveSessionId, retrieveStatusField, retrieveStatusValue, update, updateRecord
Methods inherited from class com.softwaremining.wrappers.CBLBean
addCorrespondingValue, addCorrespondingValue, allocate, assignAddressTo, assignAddressTo, assignBean, assignBytesEncoded, assignCachedInitializationValue, assignCorrespondingValue, assignCorrespondingValue, assignDefaultValue, assignEbcdicBytes, assignEbcdicJIT_PdSupportForSequentialFiles, assignEncodedValue, assignExemptFromMemRelease, assignExternal, assignHighValues, assignInternalVars, assignLowValues, assignRawEbcdicBytes, assignRedefines, assignRedefines, assignSessionId, assignStringFormatted, assignSubstring, assignSubstring, assignToAddressOf, assignToAddressOf, assignToAddressOf, assignToAddressOf, assignToAllFields, assignValue, assignValue, assignValue, assignValue, assignValue, assignValue, assignValue, calculateStorageSize, containsPointers, equals, equals, equals, equals, equalsRightTrimmed, fieldsCount, fill, fill, fill, fill, fill, getValue, hasPackedDecimalFields, initDefaultValues, initialize, initialize, isExemptFromMemRelease, isFilled, isFilled, isFilled, isFilled, isGreaterThan, isGreaterThan, isGreaterThan, isHighValues, isInvolvedInDependency, isInvolvedInExternalDependency, isLessOrEqualTo, isLessOrEqualTo, isLessOrEqualTo, isLessOrEqualTo, isLessOrEqualTo, isLessThan, isLessThan, isLessThan, isLessThan, isLessThan, isLowValues, isRedefinedByAnotherClass, isResourceAlreadyReleased, lengthOf, printFieldPosition, printFieldValues, printOrderedFieldPosition, PrintOrderedFieldPositionsAndValue, releaseResources, releaseResources, resetCachedValues, resetCompressedFieldList, resetStructure, resize, retrieveActualLength, retrieveAsInt, retrieveAsString, retrieveCachedInitializationValue, retrieveCompressedFields, retrieveDependedFieldsList, retrieveEbcdicBytes, retrieveEbcdicValue, retrieveEncodedValue, retrieveField, retrieveField, retrieveFieldAtMemoryPosition, retrieveFieldFormatted, retrieveFields, retrieveIsTargetOfPointers, retrievePrimitiveFields, retrieveRawEbcdicBytes, retrieveSQLObject, retrieveStorageCellSize, retrieveStorageChars, retrieveSubstring, retrieveSubstring, retrieveTopLevelField, retrieveValue, retrieveValue, setValue, stringValue, subtractCorrespondingValue, subtractCorrespondingValue, toString
-
Field Details
-
ADVANCE_NOT_INITIALIZED
public static final int ADVANCE_NOT_INITIALIZEDthe following variables are used in Sequential file generation. e.g. myFile.advance( LINE , 12); // where 12 represents the number of lines to advance myFile.write();- See Also:
-
LINE
public static final int LINE- See Also:
-
PAGE
public static final int PAGE- See Also:
-
EJECT
public static final int EJECT- See Also:
-
FIRST_LINE_POS
protected static final int FIRST_LINE_POS- See Also:
-
TOP_OF_PAGE
public static final int TOP_OF_PAGEfor ILE COBOL : WRITE PRINTLINE AFTER ADVANCING TO-TOP-OF-PAGE- See Also:
-
advanceType
protected int advanceType -
advanceSize
protected int advanceSize -
advanceContinuation
protected boolean advanceContinuation -
_recordSize
protected int _recordSize -
CRLFcharCount
protected int CRLFcharCountNumber of lines used for Cr / FL.
important Note : Sequential files have no CR/FL : ie value (default is 0); For Line-sequential - use 1 on Unix , 2 On java. -
firstRead
protected boolean firstRead -
firstLineTerminators
protected byte[] firstLineTerminators -
targetIsPrinter
protected boolean targetIsPrinterADVANCE PAGE for printer files will insert "\f" character. For non-printer files will insert "1" characters -
recordDependingField
For ARRAY-FIELD OCCURS DEPENDING ON INTEGER-FIELD; The list contains reference to INTEGER-FIELD. -
numberOfInitialRecords
protected transient long numberOfInitialRecordsUsed internally by SoftwareMining libraries In UNISYS, after opening the file, the system can get an estimate of how many records there are available. -
justRead
protected boolean justRead -
currentRecordNumber
protected int currentRecordNumber -
rdw_format
-
rdw_Null
protected static final byte[] rdw_Null -
RDW_LENGTH
protected static final int RDW_LENGTH- See Also:
-
useRDW
protected boolean useRDWUsed to indicate if this class uses Record Descriptor Word -
fixedLengthRecord
protected boolean fixedLengthRecordVariable records have to be LINE-SEQUENTGIAL
fixedLengthRecords are RECORD-SEQUENTIAL -
fixedLenghtRecordsEndWithNewLine
protected boolean fixedLenghtRecordsEndWithNewLineVariable records have to be LINE-SEQUENTIAL (use NewLine as delimitor)
fixedLengthRecords are usually RECORD-SEQUENTIAL. (records concatenated at end of each other)
fixedLengthRecords are RECORD-SEQUENTIAL - unless this is set to true -
lineCounter
lineCounter keeps track of lines in sequential file, as per ANSI COBOL standard -
totalRuntime
public static long totalRuntimefor internal use only ... profiling information
-
-
Constructor Details
-
AbstractSequentialFile
public AbstractSequentialFile()default Constructor- Parameters:
owner
-
-
AbstractSequentialFile
default Constructor- Parameters:
owner
-
-
-
Method Details
-
getCRLFcharCount
public final int getCRLFcharCount()show how many CRLF character are used (Windows 2 - unix 1).- Returns:
-
setCRLFcharCount
public final void setCRLFcharCount(int CRLFcharCount) set new values for CRFL count (unix uses 1, Windows 2)- Parameters:
CRLFcharCount
-
-
advance
public final void advance(int advanceType, long size) SUPPORT FOR WRITE XYZ AFTER ADVANCING PAGE - e.g.
myFile.advance( LINE , 12); // where 12 represents the number of lines to advance
myFile.write(); -
advance
SUPPORT FOR WRITE XYZ AFTER ADVANCING PAGE - e.g.
myFile.advance( LINE , 12); // where 12 represents the number of lines to advance
myFile.write(); -
advance
public final void advance(int advanceType, int size) SUPPORT FOR WRITE XYZ AFTER ADVANCING PAGE myFile.advance( LINE , 12); // where 12 represents the number of lines to advance myFile.write(); -
assignDependingField
Description copied from class:CBLBean
Information here is only used in sequentialFiles- Overrides:
assignDependingField
in classCBLBean
-
retrieveRecordDependingField
-
read
public int read()Same as next() .
Reads the next record from file. DOES NOT THROW AtEndException ... instead only the FileStatus will be changed.- Overrides:
read
in classAbstractBasePersistence
- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
-
readRecord
read the next record from file. At end thow an exception- Specified by:
readRecord
in classAbstractBasePersistence
- Returns:
- Throws:
IOCriticalException
AtEndException
-
nextWithException_UseExactRecordLenght
protected abstract int nextWithException_UseExactRecordLenght() throws IOCriticalException, AtEndExceptionfor internal SoftwareMining use- Throws:
IOCriticalException
AtEndException
-
nextWithException_UseLineBreaks
for internal SoftwareMining use- Throws:
IOCriticalException
AtEndException
-
prevWithException
- Throws:
IOCriticalException
AtEndException
-
isFileOpened
public abstract boolean isFileOpened()supporting UNISYS IF ATTRIBUTE OPEN OF record = VALUE TRUE- Returns:
-
open
public abstract int open(int openMode, boolean prefixFileNameWithCallingProgram) throws IOCriticalException - Throws:
IOCriticalException
-
exists
public boolean exists()check if data file exists- Returns:
-
nextRecord
read the next record from file. At end thow an exception- Specified by:
nextRecord
in classAbstractBasePersistence
- Returns:
- Throws:
IOCriticalException
AtEndException
-
prevRecord
Scroll back to previous record When end (or beginning) of file is reached, it throws AtEndException- Specified by:
prevRecord
in classAbstractBasePersistence
- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
- Throws:
IOCriticalException
AtEndException
-
_insertRecord
Used Internally by SoftwareMining Framework Insert (write) the current data into file.- Parameters:
groupSize
- : Used for multi 01 files ... defines the size of the group- Throws:
IOCriticalException
-
insert
Insert a record - populate the values from the existing fields -
insertRecord
public int insertRecord()Insert (write) the current data into file.- Specified by:
insertRecord
in classAbstractBasePersistence
- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
-
insertRecord
Insert (write) the current data into file.- Parameters:
field
-
-
deleteRecord
deletes the entire file- Specified by:
deleteRecord
in classAbstractBasePersistence
- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
- Throws:
IOStatusException
-
getRecordSize
protected final int getRecordSize()return the storage size of the record- Returns:
-
assignRecordSize
protected final void assignRecordSize(int newValue) for internal use only- Overrides:
assignRecordSize
in classCBLBean
- Parameters:
newValue
-
-
retrieveNumberOfInitialRecords
public final long retrieveNumberOfInitialRecords()In UNISYS, after opening the file, the system can get an estimate of how many records there are available. -
assignRecordsAreFixedLength
public final void assignRecordsAreFixedLength(boolean fixedLengthRecord) Sequential files can be LINE-SEQUENTIAL or RECORD-SEQUENIAL
false: system assumes LINE-SEQUENIAL (different length records separated by CR-LF)
true: system assumes RECORD-SEQUENTIAL (records of fixed size concatenated together)
NOTE: fixedLengthRecord (SEQUENTIAL FILES) can be forced to use a NEWLINE as delimiter through method assignFixedLenghtRecordsEndWithNewLine- Parameters:
fixedLengthRecord
-
-
isFixedLenghtRecordsEndWithNewLine
protected boolean isFixedLenghtRecordsEndWithNewLine()fixedLengthRecords are treated as SEQUENTIAL, ie records are concatenated together.
When fixedLengthRecord is false, then they are LINE-SEQUENTIAL - ie use a NEWLINE delimiter between records- Returns:
-
assignFixedLenghtRecordsEndWithNewLine
public void assignFixedLenghtRecordsEndWithNewLine(boolean fixedLenghtRecordsEndWithNewLine) Only affects SequentialFile - NOT SequentialNIO Files (they are always terminted with CR-LF
Fixed length records are treated as SEQUENTIAL files - they do not use NEWLINE character(s) as record delimiter
Setting this flag to true will add new-line character to end of each fixed-length record. (by default fixed-length are just appended to end of the previous one).- Parameters:
fixedLenghtRecordsEndWithNewLine
-
-
assignFileName
Description copied from class:AbstractBasePersistence
In Sequential File Processing - it overwrites the default name of an input/output file automatically assigned by the system.- Overrides:
assignFileName
in classAbstractBasePersistence
- Parameters:
fileName
-
-
assignTargetIsPrinter
public void assignTargetIsPrinter(boolean targetIsPrinter) ADVANCE PAGE for printer files will insert "\f" character. For non-printer files will insert "1" characters- Parameters:
targetIsPrinter
-
-
retrieveEncodedBytesForWrite
-
assignEncodedBytes
- Throws:
UnsupportedEncodingException
-
retrieveFieldLineCounter
-
retrieveFieldPageCounter
-
retrieveLineCounter
public final int retrieveLineCounter() -
retrievePageCounter
public final int retrievePageCounter()returns the current number of pages inserted into this file- Returns:
-
closeReel
public final void closeReel()implementation of sequentialFile CLOSE xxx REEL. This version doesn't do anything - the file will NOT be closed -
println
Utility method used in creating log files- Parameters:
data
-
-
retrieveCurrentRecordNumber
public int retrieveCurrentRecordNumber()An utility method used to provide an indication on current position in the data file. The position incremented on 'read() and next() - and decremented on 'prev'- Returns:
- current record Number
-
assignUsesRDW
public void assignUsesRDW(boolean usesRDW) Indicates if this class uses Record Descriptor Word -
isRDW
public boolean isRDW()Indicates if this class uses Record Descriptor Word
-