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 intstatic final intthe following variables are used in Sequential file generation.protected booleanprotected intprotected intprotected intNumber of lines used for Cr / FL.protected intstatic final intprotected static final intprotected byte[]protected booleanprotected booleanVariable records have to be LINE-SEQUENTIAL (use NewLine as delimitor)
fixedLengthRecords are usually RECORD-SEQUENTIAL.protected booleanVariable records have to be LINE-SEQUENTGIAL
fixedLengthRecords are RECORD-SEQUENTIALprotected booleanstatic final intprotected MIntegerlineCounter keeps track of lines in sequential file, as per ANSI COBOL standardprotected longUsed 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 intprotected static NumericFormatBinaryprotected static final intprotected static final byte[]protected AbstractCBLNumericFor ARRAY-FIELD OCCURS DEPENDING ON INTEGER-FIELD; The list contains reference to INTEGER-FIELD.protected booleanADVANCE PAGE for printer files will insert "\f" character.static final intfor ILE COBOL : WRITE PRINTLINE AFTER ADVANCING TO-TOP-OF-PAGEstatic longfor internal use only ...protected booleanUsed to indicate if this class uses Record Descriptor WordFields inherited from class com.softwaremining.files.AbstractFile
openModeFields inherited from class com.softwaremining.wrappers.AbstractBasePersistence
fileName, ownerClassName, statusFields 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_setFieldFormattedFields 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_CLOSE_FILE_FILE_NOT_OPEN, 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_OPEN_FILE_FILE_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 voidadvance(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 voidadvance(int advanceType, long size) SUPPORT FOR WRITE XYZ AFTER ADVANCING PAGE - e.g.final voidadvance(int advanceType, BigDecimal size) SUPPORT FOR WRITE XYZ AFTER ADVANCING PAGE - e.g.final voidassignDependingField(AbstractCBLNumeric dependingField) Information here is only used in sequentialFilesprotected voidassignEncodedBytes(byte[] finalBytes) voidassignFileName(String fileName) In Sequential File Processing - it overwrites the default name of an input/output file automatically assigned by the system.voidassignFixedLenghtRecordsEndWithNewLine(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 voidassignRecordsAreFixedLength(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 voidassignRecordSize(int newValue) for internal use onlyvoidassignTargetIsPrinter(boolean targetIsPrinter) ADVANCE PAGE for printer files will insert "\f" character.voidassignUsesRDW(boolean usesRDW) Indicates if this class uses Record Descriptor Wordfinal voidimplementation of sequentialFile CLOSE xxx REEL.intdeletes the entire filebooleanexists()check if data file existsfinal intshow how many CRLF character are used (Windows 2 - unix 1).protected final intreturn the storage size of the recordfinal intinsert(AbstractCBLField field) Insert a record - populate the values from the existing fieldsintInsert (write) the current data into file.final intinsertRecord(AbstractCBLField field) Insert (write) the current data into file.abstract booleansupporting UNISYS IF ATTRIBUTE OPEN OF record = VALUE TRUEprotected booleanfixedLengthRecords are treated as SEQUENTIAL, ie records are concatenated together.booleanisRDW()Indicates if this class uses Record Descriptor Wordintread the next record from file.protected abstract intfor internal SoftwareMining useprotected abstract intfor internal SoftwareMining useabstract intopen(int openMode, boolean prefixFileNameWithCallingProgram) intScroll back to previous record When end (or beginning) of file is reached, it throws AtEndExceptionprotected abstract intfinal voidUtility method used in creating log filesintread()Same as next() .
Reads the next record from file.intread the next record from file.intAn utility method used to provide an indication on current position in the data file.protected Stringfinal MIntegerfinal MIntegerfinal intfinal longIn UNISYS, after opening the file, the system can get an estimate of how many records there are available.final intreturns the current number of pages inserted into this filefinal AbstractCBLNumericfinal voidsetCRLFcharCount(int CRLFcharCount) set new values for CRFL count (unix uses 1, Windows 2)Methods inherited from class com.softwaremining.files.AbstractFile
assignOptional, resetDataDirectory, retrieveDataDirectory, retrieveFullFileName, retrieveOpenModeMethods 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, updateRecordMethods 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, 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, print, printFieldPosition, printFieldValues, printOrderedFieldPosition, releaseResources, releaseResources, resetCachedValues, resetCompressedFieldList, resetStorageManager, resetStructure, resize, retrieveActualLength, retrieveAsInt, retrieveAsString, retrieveCachedInitializationValue, retrieveCompressedFields, retrieveDependedFieldsList, retrieveEbcdicBytes, retrieveEbcdicValue, retrieveEncodedValue, retrieveField, retrieveField, retrieveFieldAtMemoryPosition, retrieveFieldFormatted, retrieveFields, retrieveIsTargetOfPointers, retrievePrimitiveFields, retrieveRawEbcdicBytes, retrieveRedefinesList, retrieveSQLObject, retrieveStorageBytes, retrieveStorageCellSize, 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:CBLBeanInformation here is only used in sequentialFiles- Overrides:
assignDependingFieldin 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:
readin classAbstractBasePersistence- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
-
readRecord
read the next record from file. At end thow an exception- Specified by:
readRecordin classAbstractBasePersistence- Returns:
- Throws:
IOCriticalExceptionAtEndException
-
nextWithException_UseExactRecordLenght
protected abstract int nextWithException_UseExactRecordLenght() throws IOCriticalException, AtEndExceptionfor internal SoftwareMining use- Throws:
IOCriticalExceptionAtEndException
-
nextWithException_UseLineBreaks
for internal SoftwareMining use- Throws:
IOCriticalExceptionAtEndException
-
prevWithException
- Throws:
IOCriticalExceptionAtEndException
-
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:
nextRecordin classAbstractBasePersistence- Returns:
- Throws:
IOCriticalExceptionAtEndException
-
prevRecord
Scroll back to previous record When end (or beginning) of file is reached, it throws AtEndException- Specified by:
prevRecordin classAbstractBasePersistence- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
- Throws:
IOCriticalExceptionAtEndException
-
_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:
insertRecordin 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:
deleteRecordin 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:
assignRecordSizein 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:AbstractBasePersistenceIn Sequential File Processing - it overwrites the default name of an input/output file automatically assigned by the system.- Overrides:
assignFileNamein classAbstractBasePersistence
-
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
-