Class AbstractSequentialFile

All Implemented Interfaces:
IPersistence, AbstractDataObject, ICBLBeanNGroup, ICBLContainer, IFieldContainer, ISMBean, ISMDataType
Direct Known Subclasses:
SequentialFile, SequentialNIOFile

public abstract class AbstractSequentialFile extends AbstractFile
  • Field Details

    • ADVANCE_NOT_INITIALIZED

      public static final int ADVANCE_NOT_INITIALIZED
      the 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_PAGE
      for 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 CRLFcharCount
      Number 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 targetIsPrinter
      ADVANCE PAGE for printer files will insert "\f" character. For non-printer files will insert "1" characters
    • recordDependingField

      protected AbstractCBLNumeric recordDependingField
      For ARRAY-FIELD OCCURS DEPENDING ON INTEGER-FIELD; The list contains reference to INTEGER-FIELD.
    • numberOfInitialRecords

      protected transient long numberOfInitialRecords
      Used 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

      protected static NumericFormatBinary rdw_format
    • rdw_Null

      protected static final byte[] rdw_Null
    • RDW_LENGTH

      protected static final int RDW_LENGTH
      See Also:
    • useRDW

      protected boolean useRDW
      Used to indicate if this class uses Record Descriptor Word
    • fixedLengthRecord

      protected boolean fixedLengthRecord
      Variable records have to be LINE-SEQUENTGIAL
      fixedLengthRecords are RECORD-SEQUENTIAL
    • fixedLenghtRecordsEndWithNewLine

      protected boolean fixedLenghtRecordsEndWithNewLine
      Variable 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

      protected MInteger lineCounter
      lineCounter keeps track of lines in sequential file, as per ANSI COBOL standard
    • totalRuntime

      public static long totalRuntime
      for internal use only ... profiling information
  • Constructor Details

    • AbstractSequentialFile

      public AbstractSequentialFile()
      default Constructor
      Parameters:
      owner -
    • AbstractSequentialFile

      public AbstractSequentialFile(BaseService owner)
      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

      public final void advance(int advanceType, BigDecimal 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

      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

      public final void assignDependingField(AbstractCBLNumeric dependingField)
      Description copied from class: CBLBean
      Information here is only used in sequentialFiles
      Overrides:
      assignDependingField in class CBLBean
    • retrieveRecordDependingField

      public final AbstractCBLNumeric 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 class AbstractBasePersistence
      Returns:
      when successful it returns IPersistence.STATUS_SUCCESS
    • readRecord

      public int readRecord() throws IOCriticalException, AtEndException
      read the next record from file. At end thow an exception
      Specified by:
      readRecord in class AbstractBasePersistence
      Returns:
      Throws:
      IOCriticalException
      AtEndException
    • nextWithException_UseExactRecordLenght

      protected abstract int nextWithException_UseExactRecordLenght() throws IOCriticalException, AtEndException
      for internal SoftwareMining use
      Throws:
      IOCriticalException
      AtEndException
    • nextWithException_UseLineBreaks

      protected abstract int nextWithException_UseLineBreaks() throws IOCriticalException, AtEndException
      for internal SoftwareMining use
      Throws:
      IOCriticalException
      AtEndException
    • prevWithException

      protected abstract int prevWithException() throws IOCriticalException, AtEndException
      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

      public int nextRecord() throws IOCriticalException, AtEndException
      read the next record from file. At end thow an exception
      Specified by:
      nextRecord in class AbstractBasePersistence
      Returns:
      Throws:
      IOCriticalException
      AtEndException
    • prevRecord

      public int prevRecord() throws IOCriticalException, AtEndException
      Scroll back to previous record When end (or beginning) of file is reached, it throws AtEndException
      Specified by:
      prevRecord in class AbstractBasePersistence
      Returns:
      when successful it returns IPersistence.STATUS_SUCCESS
      Throws:
      IOCriticalException
      AtEndException
    • _insertRecord

      protected abstract int _insertRecord(int groupSize) throws IOCriticalException
      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

      public final int insert(AbstractCBLField field)
      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 class AbstractBasePersistence
      Returns:
      when successful it returns IPersistence.STATUS_SUCCESS
    • insertRecord

      public final int insertRecord(AbstractCBLField field)
      Insert (write) the current data into file.
      Parameters:
      field -
    • deleteRecord

      public int deleteRecord() throws IOStatusException
      deletes the entire file
      Specified by:
      deleteRecord in class AbstractBasePersistence
      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 class CBLBean
      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

      public void assignFileName(String fileName)
      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 class AbstractBasePersistence
      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

      protected String retrieveEncodedBytesForWrite()
    • assignEncodedBytes

      protected void assignEncodedBytes(byte[] finalBytes) throws UnsupportedEncodingException
      Throws:
      UnsupportedEncodingException
    • retrieveFieldLineCounter

      public final MInteger retrieveFieldLineCounter()
    • retrieveFieldPageCounter

      public final MInteger 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

      public final void println(String data)
      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