TMF Application Programmer's Guide (G06.26+)
TMF ARLIB2 Audit-Reading Procedures
HP NonStop TMF Application Programmer’s Guide—522419-005
5-16
NonStop SQL/MP Internal Field Formats
NonStop SQL/MP Internal Field Formats
Certain fields in NonStop SQL/MP records are represented on disk in a way that does
not directly correspond to the external view of the data. Because TMF audit-reading
procedures return record and field images as they are on disk, you must understand
how the fields are represented on disk in order to interpret them.
This topic attempts to cover as many of the special cases as are currently known. The
on-disk record format is subject to change from RVU to RVU because it is not
considered to be an external feature of NonStop SQL/MP.
In the examples that follow, brackets ( [ ] ) denote a byte of storage, while an asterisk
(*) denotes an undefined byte.
Field Alignment
To conserve disk space, NonStop SQL/MP records are stored in a packed format. This
means that bytes not needed to represent the values of fields in the record are not
generally stored on disk. Each field in the record immediately follows the preceding
field with no filler bytes. This means, for example, that numeric fields following odd-
length fields are not necessarily aligned on word boundaries. The field can begin on
either an even or odd byte, depending upon whether the preceding odd-length fields
compensate for one another.
You must also consider the presence of variable-length character (VARCHAR) fields.
The length of a VARCHAR field can vary between records in the same table. This
means that, because the information in a record might not be at a fixed offset, you
cannot simply overlay the before-image or after-image buffer with the record definition
or use the offset that you might expect from an external point of view.
For example, assume that a table has the following Data Definition Language (DDL)
definition:
RECORD REC.
02 A TYPE CHARACTER 3. ! SQL type: CHARACTER
02 B TYPE BINARY 16,0. ! SQL type: SMALLINT
02 C. ! SQL type: VARCHAR
04 LENGTH TYPE BINARY 16,0.
04 VALUE TYPE CHARACTER 4.
02 D TYPE BINARY 32,0. ! SQL type: INT
END
Assume that the values of a row in the table are ABC, 5, Z, and 7. The external
representation would be as follows:
[A] [B] [C] * [0] [5] [0] [1] [Z] * * * * [0] [0] [0] [7]
| | | | \
| | | | \
Filler-byte Unused-VARCHAR-bytes Filler-byte