HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
6-: 12
formatted output statements; they specify the output format to be used in
printing data. A DISP USING or PRINT USING statement can specify output
to format directly in a format string or indirectly by referencing an
image statement.
The format string or IMAGE statement describes the output format exactly,
specifying the following:
* Type of output.
* Spacing.
* Position of the following, if appropriate:
* Plus or minus signs.
* Radix indicators.
* Exponents.
* Dollar signs.
* Blanks.
* Control characters.
Format String
The format string specifies the output format for the output items in the
display list of a DISP USING or PRINT USING statement. It is also used
in an IMAGE statement.
Syntax
format_string
Parameters
format_string format_string
(if it belongs to an IMAGE statement) or
its value (if
format_string
itself is the image of a
PRINT or DISP statement) has the following syntax:
format_spec
[,
format_spec
]...
[
num_expr
] (
format_spec
[,
format_spec
]...)
format_spec
One of the format specifiers described in "Format
Specifiers" in the following section.
num_expr
Repeat factor. Rounded to a short integer,
n
. The
format_string n
(
format_spec_list
) is equivalent to
n
adjacent copies of
format_spec_list
(see examples).
Examples
The format strings of lines 100 and 200 are equivalent. In line 200,
three is the repeat factor represented by
num_expr
, above.
100 DISP USING "DDD,XX,DDD,XX,DDD,XX"; A,B,C
200 PRINT USING "3 (DDD,XX)"; A,B,C
300 DISP USING "DDDDD,XX,ZZZ.DD"; P,Q
Format Specifiers
The
format_spec
in a format string or IMAGE statement is one of the
specifiers listed in Table 6-11. Each numeric, nonliteral string, or
compact specifier corresponds to one output item in the display list of a
DISP USING or PRINT USING statement. A space, dollar, control character,
or literal string specifier does not correspond to an item in the display
list. Instead, it directs the DISP USING or PRINT USING statement to
print or suppress characters.
Table 6-11 lists the format specifiers, tells what they specify and how
they are symbolized, and whether they can contain repeat factors.