Creating a Format

The GenFormat parameter file can contain any number of formats. To create a format, type it in the GenFormat parameter using the syntax for declaring formats. See FORMAT Syntax.

Declaring Internal and External Formats

Instead of using GenFormat to define your formats, you can write custom internal and external formats that you specify in the GenFormat parameter file. For more information on user-written formats, refer to the DATABridge Programmer’s Reference.

Binary Value Conversions

All DISPLAY formats generated by GenFormat routines convert binary values to 11-digit items in the output. For example, the data item FIELD (nn) is a binary value where nn is the number of bits. Bits do not map cleanly to digits, however, so the binary value the bits represent are converted to 11-digit items.

This binary value conversion occurs for all GenFormat DISPLAY formats. The default format (RAWFORMAT), BINARYFORMAT, and any formats you write will not have the binary format conversion.

DMSII uses FIELD in two ways. As discussed above, FIELD (nn) is an integer of nn bits. The other way DMSII uses FIELD is as a GROUP of one-bit BOOLEANs, as in the following DASDL example:

APPLE-FLAGS FIELD

(RED-GREEN;

SWEET-TART;

SOFT-HARD);

Although a FIELD item with no specified number of bits can be treated as an integer, it functions as a group for the BOOLEANs RED-GREEN, SWEET-TART, and SOFT-HARD. In this case, the GenFormat format routines ignore APPLE-FLAGS and return the value of the BOOLEANs within it.

Boolean Values

You can specify the representation of Boolean values in each format. The default is to represent TRUE as 1 and FALSE as 0, both as unsigned values. To change this representation:

BOOLEAN leadingcharacters VALUE trailingcharacters

TRUE "string"

FALSE "string"

Where

Is

leadingcharacters

Optional. Any character, such as single or double quotes, that you want to place in front of the value returned from a Boolean expression.

VALUE

Required. A literal that indicates the value returned when a Boolean expression is evaluated.

trailingcharacters

Optional. Any character, such as single or double quotes, that you want to place after the value returned from a Boolean expression.

TRUE or FALSE

Required. The Boolean values TRUE or FALSE.

"string"

Required. Any alphanumeric character or characters you want to use to represent the Boolean values TRUE or FALSE. You must enclose the string in quotation marks.

Example 1

In the following example, the Y represents TRUE and the N represents FALSE. If the Boolean evaluates to TRUE, Y is returned.

BOOLEAN VALUE

TRUE "Y"

FALSE "N"

Example 2

In the following example, lowercase true represents TRUE, and lowercase false represents FALSE. If this Boolean evaluates to true, "true " (in double quotation marks) is returned. The double quotation marks are returned because this example uses the optional leading and trailing characters for Boolean values.

Note: Insert one space after the word true so that the literals "true " and "false" have the same length (five characters). This assures that the formatted records have the same length. Otherwise, GenFormat displays a warning.

BOOLEAN "VALUE"

TRUE "true "

FALSE "false"