Guardian Procedure Calls Reference Manual (G06.25+)

Formatter Edit Descriptors
Guardian Procedure Calls Reference Manual522629-013
F-21
The O Edit Descriptor
The M edit descriptor can be useful in producing visually effective reports, by
formatting values into patterns that are meaningful in terms of the data they represent.
For example, assume that four arrays contain the following data:
Amount := 9758 21573 15532
Date := 031777 091779 090579
District := 'WEST','MIDWEST','SOUTH'
Telephone := 2135296800,2162296270,4047298400
The following format can then be used to output the data as a table whose entries are
in familiar forms. Assuming the elements are presented to the formatter in the order:
the first elements of each array, followed by the second elements of each array, and so
on, using this format:
M<$ZZ,ZZ9>,M< Z9/99/99>,3X,A8,M< (999) 999-9999>
the result would be:
$ 9,758 3/17/77 WEST (213) 529-6800
$21,573 9/17/79 MIDWEST (216) 229-6270
$15,532 9/05/79 SOUTH (404) 729-8400
The O Edit Descriptor
The O edit descriptor is used to display or interpret data values in octal (base 8) integer
form.
The O edit descriptor has the following forms:
O
w OR Ow.m
w an unsigned integer constant that defines the total field width and cannot
exceed 255. The field processed is the
w characters starting at the current
position. After the field is processed, the current position is advanced by
w
characters.
m an unsigned integer constant that defines the number of digits that must be
present on output.
The O edit descriptor is used in the same manner as the I edit descriptor where the
number base (
b) is 8, except that the O edit descriptor always treats the internal data
value as unsigned. (Refer to the description of the I edit descriptor, earlier in this
appendix.) For example, if the data item is an INT(16) in TAL, the following
conversions take place:
The “|” character is used to denote the boundaries of the output field.
Format Internal Value Result
O6 10 | 12|
O6.6 18 |000022|
O6.4 -3 |177775|