TMF Application Programmer's Guide (G06.26+)

TMF ARLIB2 Audit-Reading Procedures
HP NonStop TMF Application Programmer’s Guide—522419-005
5-17
Variable-Length Character (VARCHAR) Fields
However, the data record image on disk and in a before-image or after-image from the
audit trail actually is as follows:
[A] [B] [C] [0] [5] [0] [1] [Z] [0] [0] [0] [7]
The offset of field B is fixed (namely, the length of field A). Although field B is a
numeric field, it is not word-aligned relative to the beginning of the image. Notice also
that the offset of field D depends upon the length of field C (the VARCHAR field) and is
not fixed for all rows in the same table.
Variable-Length Character (VARCHAR) Fields
VARCHAR fields, which store character-type data, are declared with a certain
maximum length. However, any given entry can actually contain from 0 characters up
to the maximum number of characters that the particular field declaration can hold.
The external DDL declaration for a VARCHAR field is as follows:
02 VARCHAR.
04 LENGTH TYPE BINARY 16,0.
04 VALUE TYPE CHARACTER max-length.
If you store the character string FRED in a VARCHAR field whose maximum length is
8, the external view of the field is then as follows:
[0] [4] [F] [R] [E] [D] * * * *
On disk and in most images in audit records, however, the unneeded bytes are
dropped and the image is actually as follows:
[0] [4] [F] [R] [E] [D]
Within field-compressed update records, VARCHAR fields that belong to the primary
key of a table are always represented using their maximum length with blanks
appended as necessary. The character string FRED within an 8-character field in a
field-compressed update record would therefore be represented as follows:
[0] [4] [F] [R] [E] [D] [ ] [ ] [ ] [ ]
You can always determine the stored length of a VARCHAR field by looking in the
image of the field. The first word contains the length in bytes of the character portion.
If the audit record is a field-compressed update, then you can also get this information
from parameters returned by the ARFETCHFIELDVALUE or ARGETFIELDINFO
procedures.