Table of Contents

Search

  1. Preface
  2. Introduction
  3. Installation
  4. Design
  5. Operation

Field Formats

Field Formats

The format of a field may be specified in one of two ways:
  • a pre-defined format
  • a customized format definition
A pre-defined format is a shorthand way of selecting a pre-defined group of field attributes. It is selected by specifying the pre-defined name for the
<format>
value.
A customized format definition is used when no pre-defined format exists for the combination of attributes that you desire. You may combine various field attributes to your liking (as long as they do not conflict).
The following table lists the pre-defined formats and their attributes:
Format
Compression
Data
Base
Conv
Just
Filler
F
Fixed
Text
N/A
No
Right
’ ’
C
Variable
Text
N/A
No
Left
’ ’
V
1
V-type
Text
N/A
No
Left
’ ’
B
2
Variable
Binary
N/A
No
Left
0x00
I
3
Variable
Integer
0
Yes
Right
0x00
G
Fixed
Integer
0
Yes
Right
0x00
N
4
Variable
Numeric
10
Yes
Right
’0’
X
4
Variable
Numeric
16
Yes
Right
’0’
Z
4
Variable
Numeric
36
Yes
Right
’0’
R
4,5
Variable
Numeric
10
Yes
Right
’ ’
1
V-type will compress multiple embedded blanks from the input view into one blank in the target field. Therefore it should only be defined in a File-Definition. It has no effect in a View-Definition.
2
The Binary data type can hold any unstructured data. It is not necessarily a base 2 number.
3
Valid integer lengths are 1, 2, 3 or 4 bytes.
4
The Numeric data type is the printed representation of an unsigned (positive) number.
5
R format is equivalent to N, but with leading spaces instead of zeroes.

Compression

The compression attribute determines how a field is compressed/decompressed when writing to/reading from the database. Fixed compression is effectively no compression at all; the field is stored/retrieved without any compression or decompression. Variable compression means that the data will be compressed when written to the database and decompressed (to match the view definition) when read from the database. The filler character and justification determine which character is stripped /added from the record and from which end.
V-type compression will compress multiple adjacent blanks into a single blank. This can occur anywhere within the field. Note that this process is irreversible. Decompression will only add blanks at one end of the field.

Filler Character/Justification

The decompression will add the filler character to the field to pad it to the necessary length.
The compression logic will remove the filler character from either the left or right end of the field (depending on justification), until no more filler characters are left or the field is empty. The decompression will add the filler character to the field to pad it to the necessary length (as specified in the view). If the field is left justified, the truncation/padding occurs on the right. If the field is right justified, the truncation/padding occurs on the left side of the field.

Data Type

Four data types are supported:
Text
Character data
Binary
Binary (unstructured) data
Integer
1, 2, 3 or 4 byte unsigned integers
Numeric
Fields containing printable numeric digits ’0’ to ’9’, and ’a’ to ’z’ (when using base 36)

Base/Base Conversion

The Integer and Numeric data types support base conversion. Ie. the view may request a base which differs from the base of the stored data. Base conversion is only possible for bases 2 through 36.

Customized Format Definition Syntax

A customized format definition has the following syntax.
format=( [predefined fmt,] format specifier, ...)
You may base your definition on a predefined format and override certain attributes, or fully define a new custom format using format specifiers.
The
format specifier
is one of the following:
Fixed
fixed compression
Text
text data
Ljust
left justification
Rjust
right justification
Filler(<char>)
filler character
Base(nn)
base nn
Here is an example of a field definition with explicit format:
Attributes, (Base(2), Filler(0)), 16
This will format a numeric field into 16 characters in base 2 (binary base). Each position will be either ’zero’ or ’one’ and leading zeroes (the filler) will extend the value on the left if it is shorter that 16 characters. If we want the value as four hexadecimal digits instead then we should use this format:
Attributes, (Base(16), Filler(0)), 4
Which is the same as the short form (in the table above):
Attributes, X, 4

0 COMMENTS

We’d like to hear from you!