com.ibm.ims.base
Class DLITypeInfo

java.lang.Object
  |
  +--com.ibm.ims.base.DLITypeInfo
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DLISecondaryIndexInfo, DLITypeInfoList, SecondaryIndexInfo

public class DLITypeInfo
extends java.lang.Object
implements java.io.Serializable

A DLITypeInfo object is used to provide the layout of a segment's fields to the base class DLISegment. With this metadata, the DLISegment class is able to provide access to all of the fields in any segment using either the defined field name or the 1-based index of the DLITypeInfo object in the array that is registered for each segment type. The defined field name can be an alias for the defined search field name in the DBD source file. When referring to the field, you can use the field alias instead of the search or key field name, as these field names are limited to only 8 characters. Note that the field names are case sensitive and must be written exactly as defined in the DLITypeInfo objects. When defining a key or search field, you must use the DLITypeInfo(String, int, int, int, String) constructor, which allows you to provide the alias and actual name of the search or key field.

See Also:
Serialized Form

Field Summary
static int BIGINT
           
static int BINARY
           
static int BIT
           
static int BLOB
           
static int CHAR
           
static int CLOB
           
static int DATE
           
static int DOUBLE
           
static int FLOAT
           
static int INTEGER
           
static int NON_UNIQUE_KEY
           
static int NOT_KEY
           
static int PACKEDDECIMAL
           
static int SECONDARY_INDEX
           
static int SMALLINT
           
static int TIME
           
static int TIMESTAMP
           
static int TINYINT
           
static int TYPELIST
           
static int UNIQUE_KEY
           
static int VARCHAR
           
static int ZONEDDECIMAL
           
 
Constructor Summary
  DLITypeInfo(java.lang.String fieldName, int type, int startingOffset, int length)
          Constructs a DLITypeInfo object.
  DLITypeInfo(java.lang.String fieldName, int type, int startingOffset, int length, java.lang.String searchFieldName)
          Constructs a DLITypeInfo object.
  DLITypeInfo(java.lang.String fieldName, int type, int startingOffset, int length, java.lang.String searchFieldName, int keyType)
          Constructs a DLITypeInfo object, adding the ability to specify a key type.
protected DLITypeInfo(java.lang.String fieldName, int type, java.lang.String searchFieldName, int length)
           
  DLITypeInfo(java.lang.String fieldName, java.lang.String typeQualifier, int type, int startingOffset, int length)
          Constructs a DLITypeInfo object.
  DLITypeInfo(java.lang.String fieldName, java.lang.String typeQualifier, int type, int startingOffset, int length, java.lang.String searchFieldName)
          Constructs a DLITypeInfo object.
  DLITypeInfo(java.lang.String fieldName, java.lang.String typeQualifier, int type, int startingOffset, int length, java.lang.String searchFieldName, int keyType)
          Constructs a DLITypeInfo object, adding the ability to specify a key type.
 
Method Summary
 int getFieldLength()
          Returns the length of the field's value in the segment.
 java.lang.String getFieldName()
          Returns the field name given to this field in the segment.
 int getFieldOffset()
          Returns the offset of the field in the segment's I/O area.
 int getFieldType()
          Returns the type assigned to a field's value in the segment.
 int getKeyType()
          Returns the type of key the field is: DLITypeInfo.NOT_KEY DLITypeInfo.UNIQUE_KEY DLITypeInfo.NON_UNIQUE_KEY
 java.lang.String getSearchFieldName()
          Returns the search field name given to this field in the segment, which must be exactly as defined in the DBD source file.
 java.lang.String getTypeQualifier()
          Returns the type qualifier for this type.
 boolean isSigned()
          Indicates whether this type is signed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TINYINT

public static final int TINYINT

INTEGER

public static final int INTEGER

CHAR

public static final int CHAR

DOUBLE

public static final int DOUBLE

FLOAT

public static final int FLOAT

BIT

public static final int BIT

BLOB

public static final int BLOB

BIGINT

public static final int BIGINT

SMALLINT

public static final int SMALLINT

VARCHAR

public static final int VARCHAR

PACKEDDECIMAL

public static final int PACKEDDECIMAL

ZONEDDECIMAL

public static final int ZONEDDECIMAL

DATE

public static final int DATE

TIME

public static final int TIME

TIMESTAMP

public static final int TIMESTAMP

TYPELIST

public static final int TYPELIST

BINARY

public static final int BINARY

SECONDARY_INDEX

public static final int SECONDARY_INDEX

CLOB

public static final int CLOB

NOT_KEY

public static final int NOT_KEY

UNIQUE_KEY

public static final int UNIQUE_KEY

NON_UNIQUE_KEY

public static final int NON_UNIQUE_KEY
Constructor Detail

DLITypeInfo

public DLITypeInfo(java.lang.String fieldName,
                   int type,
                   int startingOffset,
                   int length)
Constructs a DLITypeInfo object. This constructor is only to be used with non-key and non-search fields. It cannot be used for zoned decmial, packed decimal, date, time, and timestamp fields. Use the DLITypeInfo(String, String, int, int, int) or DLITypeInfo(String, String, int, int, int, String) constructors for these types.

The DLITypeInfo class defines several constants that can be supplied as values for the type argument: CHAR, INTEGER, DOUBLE, FLOAT, BIT, BLOB, BIGINT, TINYINT, BINARY, and SMALLINT. Certain types have predefined lengths and cannot be changed. The INTEGER and FLOAT types are always 4 bytes long. The DOUBLE and BIGINT types are always 8 bytes long. The SMALLINT type is always 2 bytes long. The TINYINT and BIT types are always 1 byte long. If another length value is specified for one of these types, an exception will be thrown.

Parameters:
fieldName - The name of the field.
type - the type of the field
startingOffset - the starting offset in the I/O area of this field, beginning at offset 1
length - the length, in bytes, of this field
Throws:
java.lang.IllegalArgumentException - if the starting offset is less than zero, an unsupported type is given, or an invalid length is given
See Also:
DLISegment

DLITypeInfo

public DLITypeInfo(java.lang.String fieldName,
                   int type,
                   int startingOffset,
                   int length,
                   java.lang.String searchFieldName)
Constructs a DLITypeInfo object. This constructor is to be used with all key and search fields. It cannot be used for zoned decmial, packed decimal, date, time, and timestamp fields. Use the DLITypeInfo(String, String, int, int, int) or DLITypeInfo(String, String, int, int, int, String) constructors for these types. It provides functionality to provide an alias for the key and search fields. This alias name is not limited to 8 characters.

The DLITypeInfo class defines several constants that can be supplied as values for the type argument: CHAR, INTEGER, DOUBLE, FLOAT, BIT, BLOB, BIGINT, TINYINT, BINARY, and SMALLINT. Certain types have predefined lengths and cannot be changed. The INTEGER and FLOAT types are always 4 bytes long. The DOUBLE and BIGINT types are always 8 bytes long. The SMALLINT type is always 2 bytes long. The TINYINT and BIT types are always 1 byte long. If another length value is specified for one of these types, an exception will be thrown.

Parameters:
fieldName - The name of the field. This name can be an alias that maps to the the actual name as defined in the DBD source file, which is given by the searchFieldName parameter.
type - the type of the field
startingOffset - the starting offset in the I/O area of this field, beginning at offset 1
length - the length, in bytes, of this field
searchFieldName - the name of the search or key field exactly as defined in the DBD source file
Throws:
java.lang.IllegalArgumentException - if the starting offset is less than zero, an unsupported type is given, or an invalid length is given
See Also:
DLISegment

DLITypeInfo

public DLITypeInfo(java.lang.String fieldName,
                   int type,
                   int startingOffset,
                   int length,
                   java.lang.String searchFieldName,
                   int keyType)
Constructs a DLITypeInfo object, adding the ability to specify a key type. Values include: NOT_KEY indicates field is not a key field (default) UNIQUE_KEY indicates field is a (or part of) a unique key NON_UNIQUE_KEY indicates field is a (or part of) a non-unique key

DLITypeInfo

public DLITypeInfo(java.lang.String fieldName,
                   java.lang.String typeQualifier,
                   int type,
                   int startingOffset,
                   int length)
Constructs a DLITypeInfo object. This constructor is to be used with non-key and non-search fields of zoned or packed decimal, Date/Time/Timestamp data, or clob strings. Use the DLITypeInfo(String, String, int, int, int) or DLITypeInfo(String, String, int, int, int, String) constructors for all other types. The uses of the type qualifier are as follows: If the field type is either packed or zoned decimal, the type qualifier is the PICTURE string representing the layout of the field. All COBOL PICTURE strings containing valid combinations of 9s. Ps, Vs, and Ss are supported. For zoned decimal numbers, the decimal point (.) can also be used in the PICTURE string. If the field contains Date/Time/Timestamp data, the type qualifier specifies the format of the data. For example, a type qualifier of ddMMyyyy indicates that the data is formatted as follows: 02011999 is January 2, 1999. For DATE and TIME all formatting opions in the java.text.SimpleDateFormat class are supported. For the TIMESTAMP type an additional formatting option 'f' has been provided for nanoseconds. TIMESTAMP can contain up to 9 'f's and replaces the 'S' options for milliseconds; instead, 'fff' indicates milliseconds of precision. An example TIMESTAMP format is yyyy-mm-dd hh:mm:ss.fffffffff If the field type is a CLOB the type qualifier is the name of the child overflow segment. The child overflow segment is used to store any overflow characters after the first length-4 characters which will be stored in this field. This base field will only hold length-4 characters since the CLOB field type reserves the first 4 bytes for version info and length.

The DLITypeInfo class defines several constants that can be supplied as values for the type argument: CLOB, DATE, TIME, TIMESTAMP, ZONEDDECIMAL and PACKEDDECIMAL.

Parameters:
fieldName - The name of the field.
typeQualifier - the type qualifier for the field, or the child overflow segment name, as described above
type - the type of the field
startingOffset - the starting offset in the I/O area of this field, beginning at offset 1
length - the length of the field for a PACKEDDECIMAL number, the length can be calculated with the following function: ceiling((number of digits + 1)/2) for a ZONEDDECIMAL number, the length can be calculated with the following function: number of digits + 1 (if the decimal is stored in memory) number of digits (if the decimal is not stored in memory)
Throws:
java.lang.IllegalArgumentException - if the starting offset is less than zero, an unsupported type is given, or an invalid length is given

DLITypeInfo

public DLITypeInfo(java.lang.String fieldName,
                   java.lang.String typeQualifier,
                   int type,
                   int startingOffset,
                   int length,
                   java.lang.String searchFieldName)
Constructs a DLITypeInfo object. This constructor is to be used with all search fields of zoned or packed decimal, Date/Time/Timestamp data, or clob strings. Use the DLITypeInfo(String, String, int, int, int) or DLITypeInfo(String, String, int, int, int, String, int) constructors for all other types. This constructor provides functionality to provide an alias for the key and search fields. This alias name is not limited to 8 characters. The uses of the type qualifier are as follows: If the field type is either packed or zoned decimal, the type qualifier is the PICTURE string representing the layout of the field. All COBOL PICTURE strings containing valid combinations of 9s. Ps, Vs, and Ss are supported. For zoned decimal numbers, the decimal point (.) can also be used in the PICTURE string. If the field contains Date/Time/Timestamp data, the type qualifier specifies the format of the data. For example, a type qualifier of ddMMyyyy indicates that the data is formatted as follows: 02011999 is January 2, 1999. For DATE and TIME all formatting opions in the java.text.SimpleDateFormat class are supported. For the TIMESTAMP type an additional formatting option 'f' has been provided for nanoseconds. TIMESTAMP can contain up to 9 'f's and replaces the 'S' options for milliseconds; instead, 'fff' indicates milliseconds of precision. An example TIMESTAMP format is yyyy-mm-dd hh:mm:ss.fffffffff If the field type is a CLOB the type qualifier is the name of the child overflow segment. The child overflow segment is used to store any overflow characters after the first length-4 characters which will be stored in this field. This base field will only hold length-4 characters since the CLOB field type reserves the first 4 bytes for version info and length.

The DLITypeInfo class defines several constants that can be supplied as values for the type argument: CLOB, DATE, TIME, TIMESTAMP, ZONEDDECIMAL and PACKEDDECIMAL.

Parameters:
fieldName - The name of the field. This name can be an alias that maps to the the actual name as defined in the DBD source file, which is given by the searchFieldName parameter.
typeQualifier - the type qualifier for the field
type - the type of the field
startingOffset - the starting offset in the I/O area of this field, beginning at offset 1
length - the length of the field
searchFieldName - the name of the search or key field exactly as defined in the DBD source file
Throws:
java.lang.IllegalArgumentException - if the starting offset is less than zero, an unsupported type is given, or an invalid length is given

DLITypeInfo

public DLITypeInfo(java.lang.String fieldName,
                   java.lang.String typeQualifier,
                   int type,
                   int startingOffset,
                   int length,
                   java.lang.String searchFieldName,
                   int keyType)
Constructs a DLITypeInfo object, adding the ability to specify a key type. Values include: NOT_KEY indicates field is not a key field (default) UNIQUE_KEY indicates field is a (or part of) a unique key NON_UNIQUE_KEY indicates field is a (or part of) a non-unique key

DLITypeInfo

protected DLITypeInfo(java.lang.String fieldName,
                      int type,
                      java.lang.String searchFieldName,
                      int length)
Method Detail

getFieldLength

public int getFieldLength()
Returns the length of the field's value in the segment.
Returns:
int the length, in bytes

getFieldName

public java.lang.String getFieldName()
Returns the field name given to this field in the segment.
Returns:
String the name of the field

getFieldOffset

public int getFieldOffset()
Returns the offset of the field in the segment's I/O area.
Returns:
int the zero-based offset

getFieldType

public int getFieldType()
Returns the type assigned to a field's value in the segment.
Returns:
int the type

getKeyType

public int getKeyType()
Returns the type of key the field is: DLITypeInfo.NOT_KEY DLITypeInfo.UNIQUE_KEY DLITypeInfo.NON_UNIQUE_KEY

getSearchFieldName

public java.lang.String getSearchFieldName()
Returns the search field name given to this field in the segment, which must be exactly as defined in the DBD source file.
Returns:
String the name of the search field as defined in the DBD source file

getTypeQualifier

public java.lang.String getTypeQualifier()
Returns the type qualifier for this type.
Returns:
the type qualifier

isSigned

public boolean isSigned()
Indicates whether this type is signed.


(C) International Business Machines Corporation 2004. All rights reserved.