Class CBLBean

java.lang.Object
com.softwaremining.wrappers.CBLBean
All Implemented Interfaces:
AbstractDataObject, ICBLBeanNGroup, ICBLContainer, IFieldContainer, ISMBean, ISMDataType
Direct Known Subclasses:
AbstractBasePersistence, AbstractSortBean, BMSScreenBean, CommonWorkArea, Dfhaid, DfhMessageTable, Eibaid, ILEReport, ILEScreen, PCBDatabase, PCBModifiable, PCBScreen, ScratchPadArea, TransactionWorkArea

for each 01 Level field there will be a single CBLBean. This class will contain a character array representing all the fields, groups and redefined items. The fields/groups will represent positions within this character array
  • Field Details

    • tmp_lengthofAssignedValue

      protected int tmp_lengthofAssignedValue
    • log

      protected static Log log
    • INDEX_ZERO

      public static final int[] INDEX_ZERO
    • INDEX_FOR_NON_ARRAY_VERSION_OF_FIELD

      public static final int[] INDEX_FOR_NON_ARRAY_VERSION_OF_FIELD
    • EBCDIC_JIT_PD_SUPPORT_FOR_SEQ_FILES

      protected boolean EBCDIC_JIT_PD_SUPPORT_FOR_SEQ_FILES
      For use with EBCDIC files and Sequential-Files containing a single FILLER type field.
    • totalRuntime_setFieldFormatted

      public static long totalRuntime_setFieldFormatted
      for internal use only ... profiling information
    • totalRuntime_calcFieldOffsets

      public static long totalRuntime_calcFieldOffsets
    • totalRuntime_getMemoryPosition

      public static long totalRuntime_getMemoryPosition
    • totalRuntime_allocate

      public static long totalRuntime_allocate
  • Constructor Details

    • CBLBean

      public CBLBean()
      default constructor
    • CBLBean

      public CBLBean(BaseService owner)
      standard constructor
      Parameters:
      owner -
  • Method Details

    • retrieveDependedFieldsList

      public ArrayList<AbstractCBLField> retrieveDependedFieldsList()
    • assignDependingField

      public void assignDependingField(AbstractCBLNumeric dependingField)
      Information here is only used in sequentialFiles
    • retrieveFieldFormatted

      protected final String retrieveFieldFormatted(AbstractCBLField field)
      Get the storage representation of the field Retrieves the value of the field (the area of wrapper array, corresponding to the field) For packed fields (COMP, COMP-3, etc) this will return the binary version of the data.
    • retrieveStorageChars

      protected final char[] retrieveStorageChars(AbstractCBLField field)
      Get the storage representation of the field Retrieves the value of the field (the area of wrapper array, corresponding to the field) For packed fields (COMP, COMP-3, etc) this will return the binary version of the data.
    • allocate

      protected final void allocate()
      Performs array allocation. This array uses as linear storage of wrapper fields. Calculates offset for every field of wrapper. Also sets the size of allocated array.
    • retrieveIsTargetOfPointers

      public boolean retrieveIsTargetOfPointers()
    • isInvolvedInDependency

      public final boolean isInvolvedInDependency()
      Note that dependency may be established between different record-structures (Different CBLBeanss)
      Returns:
    • isInvolvedInExternalDependency

      public final boolean isInvolvedInExternalDependency()
      true when the 'dependent' and 'depending' field live in different Data-access-Objects
      Returns:
    • calculateStorageSize

      protected int calculateStorageSize(AbstractCBLField firstLevelEntry)
      this method may be overriden for Multi-fd's (sequentialFiles)
      Parameters:
      firstLevelEntry -
      Returns:
    • retrieveFields

      public final AbstractCBLField[] retrieveFields()
      Method used internally by softwaremining framework get all the fields/groups associated with this class. Note that the list will contain REDEFINED fields (if any) as well as GROUPs.
      Returns:
      Array of AbstractCBLField
    • retrieveField

      public final ISMObject retrieveField(int fieldNum)
      Method used internally by softwaremining framework Used in BerkeleyIndexedFile
      Specified by:
      retrieveField in interface ISMBean
      Parameters:
      fieldNum -
      Returns:
    • retrieveField

      public ISMObject retrieveField(String fieldName)
      Method used internally by softwaremining framework
      Specified by:
      retrieveField in interface IFieldContainer
      Specified by:
      retrieveField in interface ISMBean
      Parameters:
      fieldName -
      Returns:
    • retrieveFieldAtMemoryPosition

      public final ISMObject retrieveFieldAtMemoryPosition(int memoryPosition)
      Used primarily in CICS / VSAM-SQL classes. The method does not cater for OCCURS-DEPENDING This method is used only for debugging purpose
      Returns:
    • printFieldPosition

      public String printFieldPosition()
      returns the name of all fields and their memory position This method is used only for debugging purpose
      Returns:
    • printOrderedFieldPosition

      public String printOrderedFieldPosition()
    • PrintOrderedFieldPositionsAndValue

      public String PrintOrderedFieldPositionsAndValue()
    • printFieldValues

      public String printFieldValues()
      Debugging utility Prints the name of all fields and their memory position (System.out.println) and their current value This method is used only for debugging purpose
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fieldsCount

      public final int fieldsCount()
      Method used internally by softwaremining framework
      Returns:
    • retrieveAsString

      public final String retrieveAsString()
      Description copied from interface: ISMBean
      returns the Stringified representation of the DAO - concatenation of DAO fields according to the declared fields sizes. The result is COBOL compliant - ie Packed-Decimal Fields will be contain the same binay information as COBOL.
      Specified by:
      retrieveAsString in interface AbstractDataObject
      Specified by:
      retrieveAsString in interface ISMBean
      Specified by:
      retrieveAsString in interface ISMDataType
      Returns:
    • retrieveAsInt

      public final int retrieveAsInt()
    • stringValue

      public final String stringValue()
      Get String representation for object
      Specified by:
      stringValue in interface ISMBean
      Specified by:
      stringValue in interface ISMDataType
      Returns:
    • retrieveStorageCellSize

      public final int retrieveStorageCellSize()
      get length of the data item. Even if the group has nothing in it - then this will return the size allocated for it
      Specified by:
      retrieveStorageCellSize in interface AbstractDataObject
      Specified by:
      retrieveStorageCellSize in interface ISMDataType
      Returns:
    • retrieveActualLength

      public final int retrieveActualLength()
      Method used internally by softwaremining framework Used in CICSBaseService class ..
      Specified by:
      retrieveActualLength in interface ISMBean
      Returns:
    • retrieveValue

      public String retrieveValue()
      get value as string
      Specified by:
      retrieveValue in interface ISMBean
      Returns:
    • getValue

      public String getValue()
    • retrieveValue

      public final String retrieveValue(int idx)
      Wrapper around getString for arrayed 01 declarations
    • assignValue

      public void assignValue(String value)
      Wrapper around assignString
      Specified by:
      assignValue in interface AbstractDataObject
      Specified by:
      assignValue in interface ISMBean
      Specified by:
      assignValue in interface ISMDataType
    • assignValue

      public void assignValue(char[] incomingChars)
      Created for performance reasons only- (e.g in CICS Screen handling)
    • assignValue

      public final void assignValue(int idx, String value)
      Wrapper around assignString for arrayed 01 declarations
    • assignDefaultValue

      public final void assignDefaultValue(Object defaultValue)
      Set default initialization value for the class
      Parameters:
      defaultValue -
    • assignStringFormatted

      public final void assignStringFormatted(String value)
      Wrapper around assignString
    • assignValue

      public final void assignValue(long value)
      Wrapper around assignString
    • setValue

      public void setValue(CBLBean theValue)
    • assignValue

      public void assignValue(CBLBean from)
    • assignBean

      public void assignBean(CBLBean from)
    • assignValue

      public final void assignValue(Number value)
      Wrapper around catering for BigDecimal and BigInteger
    • assignValue

      public final void assignValue(AbstractDataObject from)
      Transfer the value from BaseWrapper to
    • assignExternal

      public void assignExternal(CBLBean externalBean)
      Deprecated.
      - now handled in Translator (see 0014763)
      Support for COBOL EXTERNAL 01 level Groups
    • containsPointers

      public final boolean containsPointers()
      indicates if this wrapper contains any pointer definitions
      Returns:
    • assignLowValues

      public final void assignLowValues()
      representation of COBOL LOW VALUES
    • isLowValues

      public final boolean isLowValues()
      Is object filled with COBOL Low Values ?
    • assignHighValues

      public void assignHighValues()
      Equivalent of COBOL HIGH VALUES
    • isHighValues

      public final boolean isHighValues()
      Is object filled with COBOL High Values ?
    • fill

      public final void fill(int filler)
      Representation of COBOL FILL Statement
      Parameters:
      filler -
    • fill

      public final void fill(byte filler)
      Representation of COBOL FILL Statement
      Parameters:
      filler -
    • fill

      public final void fill(String filler)
      Representation of COBOL FILL Statement
      Parameters:
      filler -
    • fill

      public final void fill(int startPos, int len, String filler)
      Representation of COBOL FILL Statement
      Parameters:
      filler -
    • fill

      public final void fill(int startPos, int len, byte filler)
      Representation of COBOL FILL Statement
      Parameters:
      filler -
    • assignToAllFields

      public final void assignToAllFields(boolean boolValue)
      allows assigning the value to ALL the fields (not groups) in this class.
      Parameters:
      boolValue -
    • retrieveTopLevelField

      public final ISMObject retrieveTopLevelField()
      Description copied from interface: ISMBean
      DAO classes need to have one (and only one) field / group.
      this methods retrieves the top level field / group
      Specified by:
      retrieveTopLevelField in interface ISMBean
      Returns:
    • assignCorrespondingValue

      public final void assignCorrespondingValue(CBLBean target)
      for translation of COBOL MOVE CORRESPONDING statements
      Parameters:
      target -
    • assignCorrespondingValue

      public final void assignCorrespondingValue(CBLGroup target)
      for translation of COBOL MOVE CORRESPONDING statements
      Parameters:
      target -
    • addCorrespondingValue

      public final void addCorrespondingValue(CBLBean target)
      for translation of COBOL ADD CORRESPONDING statements
      Parameters:
      target -
    • addCorrespondingValue

      public final void addCorrespondingValue(CBLGroup target)
      for translation of COBOL ADD CORRESPONDING statements
      Parameters:
      target -
    • subtractCorrespondingValue

      public final void subtractCorrespondingValue(CBLBean target)
      for translation of COBOL SUBTRACT CORRESPONDING statements
      Parameters:
      target -
    • subtractCorrespondingValue

      public final void subtractCorrespondingValue(CBLGroup target)
      for translation of COBOL SUBTRACT CORRESPONDING statements
      Parameters:
      target -
    • equals

      public final boolean equals(String value)
    • equals

      public boolean equals(CBLPointer pointerField)
    • isLessThan

      public final boolean isLessThan(AbstractCBLField value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isLessThan

      public final boolean isLessThan(int value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isLessThan

      public final boolean isLessThan(String value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isLessThan

      public final boolean isLessThan(double value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isLessThan

      public final boolean isLessThan(long value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isLessOrEqualTo

      public final boolean isLessOrEqualTo(AbstractCBLField value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isLessOrEqualTo

      public final boolean isLessOrEqualTo(int value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isLessOrEqualTo

      public final boolean isLessOrEqualTo(String value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isLessOrEqualTo

      public final boolean isLessOrEqualTo(double value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isLessOrEqualTo

      public final boolean isLessOrEqualTo(long value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isGreaterThan

      public final boolean isGreaterThan(AbstractCBLField value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isGreaterThan

      public final boolean isGreaterThan(long value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isGreaterThan

      public final boolean isGreaterThan(String value)
      compare values of this field with the target field
      Parameters:
      value -
      Returns:
    • isFilled

      public final boolean isFilled(byte filler)
      Is object filled with 'filler'
    • equalsRightTrimmed

      public boolean equalsRightTrimmed(String theVal)
    • isFilled

      public final boolean isFilled(String filler)
      Is object filled with 'filler'
    • isFilled

      public final boolean isFilled(int filler)
      Is object filled with 'filler'
    • isFilled

      public final boolean isFilled(char filler)
      Is object filled with 'filler'
    • retrieveSubstring

      public final String retrieveSubstring(int offset, int length)
      returns the Substring - similar to getValue() returning a StringValue - then performing StringValue.subString(offset , offset+length) However, When offset / offset+length falls outside the StringValue (e.g. if offset is -1), the standard java.subString will throw an exception. But this method will handle it like COBOL by returning SPACE
      Parameters:
      offset -
      length -
      Returns:
    • retrieveSubstring

      public final String retrieveSubstring(int offset)
      returns the Substring - similar to getValue() returning a StringValue - then performing StringValue.subString(offset) However, When offset falls outside the StringValue (e.g. if offset is -1), the standard java.subString will throw an exception. But this method will handle it like COBOL by returning SPACE
      Parameters:
      offset -
      Returns:
    • assignSubstring

      public final void assignSubstring(int offset, int length, String theValue)
      translation of MOVE 'A' TO ABC (5:4)
      Parameters:
      offset -
      length -
      theValue -
    • assignSubstring

      public final void assignSubstring(int offset, String theValue)
    • retrievePrimitiveFields

      public List<AbstractCBLField> retrievePrimitiveFields()
      for internal use only. Used in EBCDIC data transfer
      Specified by:
      retrievePrimitiveFields in interface ICBLBeanNGroup
      Returns:
    • hasPackedDecimalFields

      protected boolean hasPackedDecimalFields()
      for internal use only. Used in EBCDIC data transfer
      Returns:
    • retrieveCompressedFields

      public List<AbstractCBLField> retrieveCompressedFields()
      For internal use Only
    • resetCompressedFieldList

      public void resetCompressedFieldList()
      For internal use Only
    • retrieveEbcdicValue

      public final String retrieveEbcdicValue()
      return the EBCDIC representation of this record
      Returns:
    • assignBytesEncoded

      public void assignBytesEncoded(byte[] thebytes) throws UnsupportedEncodingException
      for internal use only. Used by the file-readers - to convert to /from ebcdic IF the flag DATAFILES_ARE_EBCDIC is set
      Parameters:
      thebytes -
      Throws:
      UnsupportedEncodingException
    • assignEbcdicBytes

      public void assignEbcdicBytes(byte[] thebytes)
      Transfer EBCDIC bytes to the wrapper. This method can be used for mainframe communication using JNI or CICS Containers
      Parameters:
      thebytes -
    • retrieveEbcdicBytes

      public byte[] retrieveEbcdicBytes()
      Converts the current (UTF) data to EBCDIC Bytes. For use on Mainframes. The system assumes a single byte per char. Ie data is not in multi-byte format This
      Parameters:
      thebytes -
    • assignRawEbcdicBytes

      public void assignRawEbcdicBytes(byte[] theBytes)
    • retrieveRawEbcdicBytes

      public byte[] retrieveRawEbcdicBytes()
      Returns:
    • assignEncodedValue

      public void assignEncodedValue(String theLine)
      Used by the file-readers - to convert to /from ebcdic IF the flag DATAFILES_ARE_EBCDIC is set
      Parameters:
      theLine -
    • retrieveEncodedValue

      public String retrieveEncodedValue()
      Returns:
      Throws:
      UnsupportedEncodingException
    • resetCachedValues

      public final void resetCachedValues(boolean recursive)
      remove the cached values from all fields
    • assignAddressTo

      public void assignAddressTo(CBLPointer pointerField)
    • assignAddressTo

      public void assignAddressTo(CBLBean targetWrapper)
      Translation of COBOL's
      SET pointer TO ADDRESS OF record-2.
      Parameters:
      pointerField -
    • assignToAddressOf

      public void assignToAddressOf(ISMDataType target)
    • assignToAddressOf

      public void assignToAddressOf(CBLBean target)
      Support for COBOL SET pointer (this) TO ADDRESS OF targetField
      Specified by:
      assignToAddressOf in interface ICBLContainer
      Parameters:
      targetField -
    • assignToAddressOf

      public void assignToAddressOf(String target)
    • assignToAddressOf

      public void assignToAddressOf(AbstractCBLField targetField)
      Description copied from interface: ICBLContainer
      Used internally for setAddressOf on a field. The addressOF will be treated similar to "Redefines". After that, we need to unAllocate and re-allocated
      Specified by:
      assignToAddressOf in interface ICBLContainer
    • isRedefinedByAnotherClass

      public boolean isRedefinedByAnotherClass()
      if ABC REDEFINES XYZ or ABC.assignRedefines(XYZ); Then ABC probably contains a lot of
    • assignRedefines

      public final void assignRedefines(AbstractCBLField redefineField)
      For handling COBOL SET ADDRESS OF
    • assignRedefines

      public final void assignRedefines(CBLBean targetWrapper)
      For handling COBOL Redefines
    • assignRecordSize

      protected void assignRecordSize(int newValue)
      For internal use only
      resizing SequentialNIOFile need this
      Parameters:
      newValue -
    • resize

      public final void resize(int newSize)
      Allows resizing of custom built DAO class - which contain a single String field.
      Parameters:
      newSize -
    • lengthOf

      public int lengthOf()
      Equivelant to IBM COBOL LENGTH OF function: Number of bytes used by a data item
      Returns:
    • retrieveCachedInitializationValue

      protected String retrieveCachedInitializationValue()
    • assignCachedInitializationValue

      protected void assignCachedInitializationValue(String newValue)
    • resetStructure

      public void resetStructure(boolean resetDAOInitialValues)
      fills the underlying char array (if any present) to '0' - (this is the status at the time of instantiation). Then it calls InitDefaultValues
      Specified by:
      resetStructure in interface ISMBean
    • initDefaultValues

      protected void initDefaultValues()
    • initialize

      public void initialize()
      Description copied from interface: ISMBean
      Equivalent of COBOL's INITIALIZE statement
      Specified by:
      initialize in interface ISMBean
    • initialize

      public void initialize(int startPos, int endPos)
    • equals

      public boolean equals(long arg0) throws NumberFormatException
      Compares content of the wrapper as a group with numerical arg0. Passes IF--TEST-GF-4 from NC103a in NIST
      Throws:
      NumberFormatException
    • equals

      public boolean equals(int arg0) throws NumberFormatException
      Compares content of the wrapper as a group with numerical arg0. Passes IF--TEST-GF-4 from NC103a in NIST
      Throws:
      NumberFormatException
    • releaseResources

      public void releaseResources()
      this is called internally - after a program is CANCEL'ed. it is to help with the GC process
    • releaseResources

      public void releaseResources(boolean forceRelease)
      Description copied from interface: ISMBean
      For internal use only - memory management stuff
      Specified by:
      releaseResources in interface ISMBean
      Parameters:
      forceRelease -
    • retrieveSQLObject

      public Object retrieveSQLObject()
      Specified by:
      retrieveSQLObject in interface ISMDataType
    • assignExemptFromMemRelease

      public void assignExemptFromMemRelease(boolean exempt)
      for internal use only
      Specified by:
      assignExemptFromMemRelease in interface ISMBean
      Parameters:
      exempt -
    • isExemptFromMemRelease

      public boolean isExemptFromMemRelease()
      for internal use only
      Specified by:
      isExemptFromMemRelease in interface ISMBean
      Returns:
    • isResourceAlreadyReleased

      public boolean isResourceAlreadyReleased()
      Specified by:
      isResourceAlreadyReleased in interface ISMBean
    • assignSessionId

      public void assignSessionId(Long sessionId)
      For internal use only
      Specified by:
      assignSessionId in interface ISMBean
    • retrieveSessionId

      public Long retrieveSessionId()
      For internal use only
      Specified by:
      retrieveSessionId in interface ISMBean
    • assignInternalVars

      public void assignInternalVars(CBLBean fromClass)
      for internal use only - Introduced to allow CICS BMSSCreenBeans override this method
      Parameters:
      fromClass -
    • assignEbcdicJIT_PdSupportForSequentialFiles

      public void assignEbcdicJIT_PdSupportForSequentialFiles(boolean newVal)
      For use with EBCDIC files and Sequential-Files containing a single FILLER type field. In such cases, when working with data which have Packed-Decimal Fields, then the system will try to perform EBCDIC to ASCII conversion when data has been moved to the FILLER (instead of at WRITE time) or will perform EBCDIC to ASCII conversion when data is moved from FILLER to another structure containing PD fields
      Parameters:
      newVal -