Guardian Programmer's Guide

Table Of Contents
Formatting and Manipulating Character Data
Guardian Programmer’s Guide 421922-014
19 - 18
Applying a Scale Factor
You can apply a scale factor to move the position of the decimal point in a fixed-point
or floating-point number. Once you set a scale factor, it remains in effect until you
change it.
The scale factor descriptor has the format Pn, where n is the number of places by
which the implied decimal point moves.
This edit descriptor affects all subsequent D, E, F, and G edit descriptors. Compare
the following two sets of examples. The first set shows the results of formatting a
fixed-point number and a floating-point number without a scale factor; the second set
shows the same numbers formatted with a scale factor of 3:
Without a scale factor:
With a scale factor of 3:
Applying Optional Plus Control
You can control whether the formatter precedes positive numbers transmitted into the
output buffer with a plus sign. By default, positive numbers on output are not preceded
by a plus sign.
You can use the SP edit descriptor to cause FORMATDATA[X] to put the plus signs
into the output buffer. Once you specify plus signs, every positive number is displayed
with a plus sign until you turn off the plus by using the S or SS edit descriptor.
The following example shows the use of the edit descriptors used in plus control,
assuming that plus control is initially turned off:
Format: F10.4,E12.3
Data
values:
123.4567,123.4567
Output: 123.4567 0.123E+03
Format: P3,F10.4,E12.3
Data
values:
123.4567,123.4567
Output: 123456.7 0.123E+06
Format: I4,SP,I4,I4,SS,I4
Data
values:
34,45,56,67
Output: 34 +45 +56 67