Support for variable-length database segments with the IMS Universal drivers
The IMS Universal database resource adapter and the IMS Universal JDBC driver manage variable-length segments on behalf of client application programs. Application programs that use the IMS Universal DL/I driver must manage the LL field data for variable-length segments.
Using the LL field with the IMS Universal database resource adapter and IMS Universal JDBC driver
By
default, the LL field for a variable length segment is not returned
as a visible column for SQL queries. When the LL field is not requested,
the IMS Universal database resource
adapter and IMS Universal JDBC
driver manage the LL field on behalf of the application program. The
LL field data is not accessible by any type of query (including SELECT
*) unless your application program explicitly requests the
column when it creates a data connection to IMS.
If you want to manage the LL field at the application level, and your application uses the IMS Universal database resource adapter or the IMS Universal JDBC driver, you must explicitly request the LL field data by setting the llField property to true.
Your application can set the llField property to true in the standard properties list of either of the following interfaces:
java.sql.DriverManager.getConnection(String url, Properties properties)com.ibm.ims.jdbc.IMSDataSource.setProperties(Properties properties)When the llField=true property is set, the LL field is exposed as a normal column in the standard SQL result set for all operations. You can read, insert, or update the LL field data directly. Deleting the LL field data also deletes the rest of the associated database record. To set a field to the null state, set the length of the segment (the value of the LL field column) to be smaller than the offset of the field within the segment.
The LL field is 2 bytes long and must be handled as BINARY, SHORT, or USHORT data.
You can also use the java.sql.ResultSet.wasNull method to determine whether a nullable field exists in an instance of a variable-length segment without examining the LL data.
Checking for null field instances with the IMS Universal DL/I driver
Applications that use the IMS Universal DL/I driver always receive the LL field data for a variable-length segment. You can determine if a field is null in a segment instance in one of two ways: either compare the LL field data to the offset of the field, or use the com.ibm.ims.dli.Path.wasNull() method.
The com.ibm.ims.dli.Path.wasNull() method returns a boolean value for the null state of the last field that was read. The returned value is true if the field is null. You must attempt to read a field before calling the wasNull() method to determine whether the field is null.