Guardian Programmer's Guide

Table Of Contents
Formatting and Manipulating Character Data
Guardian Programmer’s Guide 421922-014
19 - 6
Format-Directed Formatting
Introduction to Edit Descriptors
As indicated previously, for both input formatting and output formatting you need to
supply the FORMATCONVERT[X] procedure with a sequence of edit descriptors that
specify how the FORMATDATA[X] procedure will format the data. This sequence of
edit descriptors must be supplied in an external (ASCII) format to
FORMATCONVERT[X].
The external format consists of a sequence of edit descriptors separated by commas.
Edit descriptors can be repeatable or nonrepeatable as described below:
Repeatable edit descriptors include all edit descriptors that require data.
Repeatable edit descriptors include all kinds of numbers and ASCII characters.
They are called repeatable because the edit descriptor can specify multiple
occurrences of the data type. The corresponding data descriptor must point to an
array of multiple data elements that will satisfy the repeated edit descriptor.
The following are examples of repeatable edit descriptors:
Nonrepeatable edit descriptors do not correspond to data. They contain all the
information needed for formatting. Nonrepeatable edit descriptors include literals,
tabulation descriptors, and buffer-control characters. They are called
nonrepeatable edit descriptors because one edit descriptor cannot represent
multiple data items.
The following are examples of nonrepeatable edit descriptors:
Each edit descriptor can have its properties changed using special character
seq
uences called modifiers or decorations:
A modifier is a code used to alter the results of the formatting prescribed by the
edit descriptor to which it belongs. Modifiers include left and right justification and
fill-character specification.
The following example uses the “LJ” modifier to left-justify a 12-character string:
[LJ]A12
A decoration specifies alphanumeric strings that can be added to a field either
before formatting begins or after it has finished.
The following example uses the “MA” decoration to print the text “negative number”
before a fixed-point number if the number is negative:
[MA"negative number"]F10.3
I5 A five-numeric integer
10(A12) A 12-character alphanumeric string repeated 10 times
TR8 Moves the buffer pointer eight character positions to the right of the
current position
EIGHT The literal “EIGHT