Format Definition ($FORMAT/$ENDFMT)

$FORMAT

$ENDFMT

The $FORMAT/$ENDFMT command pair defines the beginning and ending of the report lines in a group. Each report line has an associated field definition line. $FORMAT / $ENDFMT command pair goes before the $FIELDS command within the $GROUP / $ENDGRP commands for a group.

A report line shows the text and variables on a line in the report. You must enter the report lines in their printing sequence. You describe variable data on the report line using standard 4GL picture characters.

A field definition line associates a field label with each variable field defined on the report line immediately above it. The field definition line also defines the beginning and ending of text phrases. rptgen stores phrases in a language file so you can translate them and print the report in other languages. rptgen stores only the words in the phrase; it does not store special characters, such as periods and hyphens. A field definition line must immediately follow each report definition line even when there are no variable fields defined on the preceding report line.

The following table shows the characters used on a field definition line to define text and variable fields on a report line.

Type To
Pipe | Define the beginning of a phrase, except when that phrase continues on another line.
Caret ^ Define the beginning of a phrase when that phrase continues on another line. This instructs rptgen to store the column of words as a phrase.

A caret (^) must have another caret or a pipe (|) directly below it. The last entry in a columnar phrase must begin with a pipe. All parts of the column phrase must be the same length.

In the following example, Account Number is a single phrase. Although Description and Amount are in a column, they are two separate phrases because they each begin with a pipe.

 Account             Description
 ^     ;             |         ;
 Number              Amount
 |    ;              |    ;
Semicolon ;

Define the end of a phrase

Define the end of a field when it is not clear form the 4GL picture. For example, the following report line has three fields:

XXXXX-999999-9999
A   ; B    ; C

A is the account unit, B is the account number, and C is the subaccount. The hyphen (-) between the fields is constant text, but rptgen treats it like a minus sign unless there is an end-of-field character (;) to mark the end of the account unit and account number fields. A space marks the end of the subaccount field.

In contrast, the report compiler treats a hyphen as a minus sign if there is no end-of-field character (;). In the following example, the Control Total field will have a trailing minus for negative values.

Control Total ZZ,ZZZ,ZZZ,ZZZ.99-

| ; H

Telephone numbers are an exception; picture them as (999)999-9999 for U.S. format only, and specify them as type TN in the $FIELDS section.

See Field Type for further information.

Field Identifier

Label the data fields. A field label must be one to three characters and must begin with an alphabetic character. You can follow the alphabetic character with one or two numeric digits.

You must further define each name specified here in the $FIELDS section of this group. rptgen treats any set of variables that use the same field name as an array, so they all must have the same picture specification. For more information, see Field Definitions.

To insert a blank report line on a report, type a percent sign (%) in the first position of the report line and leave the rest of the line blank. You do not need a field definition line after a blank report line.