Creating a FormatThe 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 FormatsInstead 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 ConversionsAll 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 ValuesYou 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"
Example 1In 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 2In 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" | ||||||||||||
|