Format Specifications
You can give special format specifications to expressions in the report in the .print statement or in a .format or .tformat statement. The format determines whether the data is printed as a character string, decimal value, date, or in some other format. Be sure to use the right type of format depending on the type of expression. If no format is specified, Report-Writer determines a default format from an analysis of your other statements.
The following formats are allowed:
• B format specifies that the value be blanked out. This is a special format used for blanking out a field, for use with temporary formats in conjunction with the .tformat statement.
• C format specifies character strings.
• Date templates are formats that allow you very detailed control over the appearance of dates and times in your reports.
• E format specifies numeric expressions printed in scientific notation.
• F format specifies numeric expressions. In the F format, you can control the placement of the decimal point or suppress it entirely.
• G format specifies numeric expressions. This format chooses either F or E format, depending on what fits in the field width. This format also guarantees that decimal points align, whether printed in F or E format.
• I format specifies numeric expressions printed in integer format.
• N format specifies numeric expressions like G format, but decimal points do not necessarily align.
• Numeric templates are complex formats for numeric data that allow you to control placement of dollar signs, commas, or other punctuation within the number.
• Q0 format specifies character strings like the C format, except that control characters can be part of the character string without affecting the layout of the report.
• T format specifies character strings like the C format, except that it displays certain unprintable characters in a visible format.
Each of these formats is discussed in more detail in its own section later in this chapter.
You can precede any of the preceding format specifications with a sign character to indicate that the value printed is to be either right justified, left justified, or centered. The following list describes each of the valid sign characters:
• A minus sign (-) indicates that the data is to be left-justified in the specified field width.
• An asterisk (*) indicates that the data is to be centered in the width of the field.
• A plus sign (+) indicates that the data is to be right-justified in the specified field width.
The behavior of the sign characters is different for each data type. The discussions for each data format type later in this section contain examples of the effect of each sign character. If no sign is given, justification defaults to left justification for character fields and right justification for numeric fields.
Last modified date: 04/03/2024