beautypg.com

3 terminal-to-ansi format conversion – Compaq COBOL AAQ2G1FTK User Manual

Page 487

background image

Using the REFORMAT Utility

14.2 ANSI-to-Terminal Format Conversion

Placing the converted code in positions 1 to the end of the line, thereby
creating a terminal format line

Note

When you convert programs that contain continued nonnumeric literals
you should examine those literals to see if they require any changes. (This
should occur only when going from ANSI format to terminal format.)

14.3 Terminal-to-ANSI Format Conversion

REFORMAT converts each terminal format source line to ANSI format by:

Placing a 6-character line number (000010) in the first six character positions
of the first line and increasing it by 000010 for each subsequent line.

Moving any continuation symbol ( - ), or the comment symbols ( * or / ) from
character position 1 into character position 7.

Removing the backslash character ( \ ), if any, from character position 1 in
terminal format and moving the following conditional compilation character
into character position 7 of the ANSI format line.

Replacing horizontal tabs with space characters at every eighth character
position, starting at character position 5 and ending at the end of the line.

Moving spaces into remaining character positions after the last character of
code and before character position 73.

Expanding a terminal line with more than 65 characters into two or more
ANSI format lines and right-justifying these lines at character position 72.

Placing either identification characters (if supplied at program initialization)
or spaces into character positions 73 to 80.

Right-justifying (at position 72) the first line of a continued nonnumeric
literal. This ensures that the literal remains the same length as it was in the
default format.

Replacing every form-feed record with a line containing a slash ( / ) in position
7 and space characters in positions 8 to 72.

Placing the converted code in character positions 8 to 72, thereby creating one
or more ANSI format lines.

Note that it is possible to construct a terminal format line that converts to an
invalid ANSI formatted line. Consider the case of a conditional compilation line
with a long nonnumeric literal:

\A

01

ART

PIC X(80)

VALUE "A ... A".

This statement cannot be reformatted to a valid ANSI statement. The literal is
80 characters long, which indicates that the literal must be continued on the next
line by placing a continuation symbol ( - ) in the indicator area. The line is also
a conditional compilation line, which indicates that the A is to be placed in the
indicator area. Clearly both characters cannot be placed in the indicator area.
Compaq COBOL continues the conditional compilation line by placing the A in
the indicator area. This means the program remains valid if conditionals are not
used in the compilation because the lines become comment lines. If conditionals
are used, you must locate and correct these invalid lines. The reformat program

Using the REFORMAT Utility 14–3