aboutsummaryrefslogtreecommitdiff
path: root/gcc/cobol/gcobol.1
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cobol/gcobol.1')
-rw-r--r--gcc/cobol/gcobol.1291
1 files changed, 171 insertions, 120 deletions
diff --git a/gcc/cobol/gcobol.1 b/gcc/cobol/gcobol.1
index 64c017c..ebb833c 100644
--- a/gcc/cobol/gcobol.1
+++ b/gcc/cobol/gcobol.1
@@ -39,7 +39,7 @@ compiles \*[lang] source code to object code, and optionally produces an
executable binary or shared object. As a GCC component, it accepts
all options that affect code-generation and linking. Options specific
to \*[lang] are listed below.
-.Bl -tag -width \0\0debug
+.Bl -tag -width "\0\0debug"
.It Fl main Ar filename
.Nm
will generate a
@@ -97,8 +97,9 @@ Define a CDF name (for use with
to have the value of
.Ar expr .
.It Fl E
-Write the CDF-processed \*[lang] input to standard output in free-form
-reference format. Certain non-\*[lang] markers are included in the
+Write the CDF-processed \*[lang] input to standard output in
+.Em "free-form reference format".
+Certain non-\*[lang] markers are included in the
output to indicate where copybook files were included. For
line-number consistency with the input, blank lines are retained.
.Pp
@@ -147,13 +148,13 @@ and
in that order.
.It Fl ffixed-form
Use strict
-.Em "Reference Format"
+.Em "fixed-form reference format"
in reading the \*[lang] input:
72-character lines, with a 6-character sequence area, and an indicator
column. Data past column 72 are ignored.
.It Fl ffree-form
Force the \*[lang] input to be interpreted as
-.Em "free format" .
+.Em "free-form reference format".
Line breaks are insignificant, except that
.Ql *
at the start of a line acts as a comment marker.
@@ -187,12 +188,21 @@ the entire program could appear on one line.
.Pp
By default,
.Nm
-auto-detects the source code format by examining the
-.Em "sequence number area"
-of the first line of the first file: if those characters are all
-digits or blanks, the file is assumed to be in
-.Em "reference format" ,
+auto-detects the source code format by examining the line that
+contains the text "program-id". When there are characters on past column 72
+on that line, the file is assumed to be in
+.Em "extended source format",
with the indicator area in column 7.
+Otherwise, columns 1-6 are examined. If those characters are all digits
+or blanks, the file is assumed to be in
+.Em "fixed-form reference format",
+also with the indicator in column 7.
+If not auto-detected as
+.Em "fixed-form reference format"
+or
+.Em "extended source format",
+the file is assumed to be in
+.Em "free-form reference format".
.Pp
.
.It Fl fcobol-exceptions Ar exception Op Ns , Ns Ar exception Ns ...
@@ -224,7 +234,7 @@ had appeared.
Not all exception conditions are implemented. Any that are not
produce a warning message.
.
-.It Fl fmax-errors Ar nerror
+.It Fl fmax-errors Ns Li = Ns Ar nerror
.Ar nerror
represents the number of error messages produced. Without this option,
.Nm
@@ -577,6 +587,21 @@ statement, regardless of compile-time constants.
..
.
.Ss Implemented Exception Conditions
+By default, per ISO, no EC is enabled. Implemented ECs may be enabled
+on the command line or via the
+.Sy TURN
+directive. Any attempt to enable an EC that is not implemented is
+treated as an error.
+.Pp
+An enabled EC not handled by a
+.Sy DECLARATIVE
+is written to the system log and to standard error. (The authors
+intend to make that an option.) A fatal EC not handled with
+.Sy RESUME
+ends with a call to
+.Xr abort 3
+and process termination.
+.Pp
Not all Exception Conditions are implemented. Any attempt to enable
an EC that that is not implemented produces a warning message.
The following are implemented:
@@ -903,11 +928,90 @@ or
has no effect; the two are interchangeable.
..
.
-.Ss Compiler-Directing Facility (CDF)
+.Sh COMPILER-DIRECTING FACILITY
The CDF should be used with caution because no comprehensive test
-suite has been identified.
+suite has been identified.
+.
+.Ss CDF Text Manipulation
+.Bl -tag -width >>DEFINE
+.It Sy COPY Ar copybook Li Oo OF|BY Ar library Oc Oo Sy REPLACING ... Oc
+If
+.Ar copybook
+is a literal, it treated a literal filename, which either does or does not exist. If
+.Ar copybook
+is a \*[lang] word,
+.Nm
+looks first for an environment variable named
+.Va copybook
+and, if found, uses the contents of that variable as the name of the
+copybook file. If that file does not exist, it continues looking for
+a file named one of:
+.sp
+.Bl -bullet -compact -offset 5n
+.It
+.Pa copybook
+(literally)
+.It
+.Pa copybook.cpy
+.It
+.Pa copybook.CPY
+.It
+.Pa copybook.cbl
+.It
+.Pa copybook.CBL
+.It
+.Pa copybook.cob
+.It
+.Pa copybook.COB
+.El
+.sp
+in that order. It looks first in the same directory as the source
+code file, and then in any
+.Ar copybook-path
+named with the
+.Fl I
+option.
.
-.Ss Conditional Compilation
+.\" FIXME: need escape mechanism for directories with ':' in the name.
+.Ar copybook-path
+may (like the shell's
+.Ev PATH
+variable) be a colon-separated list.
+The
+.Fl I
+option may occur multiple times on the command line. Each successive
+.Ar copybook-path
+is concatenated to previous ones.
+Relative paths (having no leading
+.Ql / Ns
+\&)
+are searched relative to the compiler's current working directory.
+.Pp
+For example,
+.D1 \&
+.D1 Fl I Li /usr/local/include:include
+.D1 \&
+searches first the directory where the \*[lang] program is found, next in
+.Pa /usr/local/include ,
+and finally in an
+.Pa include
+subdirectory of the directory from which
+.Nm
+was invoked.
+.Pp
+For the
+.Sy REPLACING
+phrase, both the modern pseudo-text and the \*[lang]/85 forms are
+recognized. (The older forms are used in the NIST CCVS/85 test suite.)
+.It Sy REPLACE ...
+.Nm
+supports the full ISO
+.Sy REPLACE
+syntax.
+.El
+.
+.Ss CDF Directives
+.\"Bl -tag -width >>PROPAGATE
.Bl -tag -width >>DEFINE
.It >> Ns Sy DEFINE Ar name Sy AS Bro Ar expression Li | Sy PARAMETER Brc Op Sy OVERRIDE
Define
@@ -949,10 +1053,6 @@ is supported. Boolean literals are not supported.
.
.It >> Ns Sy EVALUATE
Not implemented.
-.El
-.
-.Ss Other CDF Directives
-.Bl -tag -width >>PROPAGATE
.It >> Ns Sy CALL-CONVENTION Ar convention
.Ar convention
may be one of:
@@ -1000,9 +1100,12 @@ to standard error as a warning message.
may be one of:
.Bl -tag -compact
.It Sy FIXED
-Source conforms to \*[lang] Reference Format with unlimited line length.
+Source conforms to \*[lang]
+.Em "fixed-form reference format"
+with unlimited line length.
.It Sy FREE
-Line endings and indentation are ignored by the compiler, except that a
+Source conforms to \*[lang]
+.Em "free-form reference format".
.Ql "*"
at the beginning of a line is recognized as a comment.
.El
@@ -1023,6 +1126,24 @@ Not implemented.
Not implemented.
.It >> Ns Sy PROPAGATE
Not implemented.
+.It >> Ns Sy PUSH Ar directive
+.It >> Ns Sy POP Ar directive
+With
+.Sy PUSH ,
+push CDF state onto a stack.
+With
+.Sy POP ,
+return to the prior pushed state.
+.Ar directive
+may be one of
+.Bl -tag -compact
+.It Sy CALL-CONVENTION
+.It Sy COBOL-WORDS
+.It Sy DEFINE
+.It Sy SOURCE FORMAT
+.It Sy TURN
+.El
+.
.It >> Ns Sy TURN Oo
.Ar ec Oo Ar file Li ... Oc ...
.Oc Sy CHECKING Bro Oo Sy ON Oc Oo Oo Sy WITH Oc Sy LOCATION Oc | Sy OFF Brc
@@ -1073,76 +1194,6 @@ the directive must appear before
.Pp
To test a feature-set variable, use
.Dl >>IF Ar feature Li DEFINED
-..
-.Ss Copybooks
-.Nm
-supports the CDF
-.Sy COPY
-statement, with or without its
-.Sy REPLACING
-component. For any statement
-.sp
-.D1 COPY Ar copybook
-.sp
-.Nm
-looks first for an environment variable named
-.Va copybook
-and, if found, uses the contents of that variable as the name of the
-copybook file. If that file does not exist, it continues looking for
-a file named one of:
-.sp
-.Bl -bullet -compact -offset 5n
-.It
-.Pa copybook
-(literally)
-.It
-.Pa copybook.cpy
-.It
-.Pa copybook.CPY
-.It
-.Pa copybook.cbl
-.It
-.Pa copybook.CBL
-.It
-.Pa copybook.cob
-.It
-.Pa copybook.COB
-.El
-.sp
-in that order. It looks first in the same directory as the source
-code file, and then in any
-.Ar copybook-path
-named with the
-.Fl I
-option.
-.
-.\" FIXME: need escape mechanism for directories with ':' in the name.
-.Ar copybook-path
-may (like the shell's
-.Ev PATH
-variable) be a colon-separated list.
-.
-The
-.Fl I
-option may occur multiple times on the command line. Each successive
-.Ar copybook-path
-is concatenated to previous ones.
-Relative paths (having no leading
-.Ql / Ns
-\&)
-are searched relative to the compiler's current working directory.
-.Pp
-For example,
-.D1 \&
-.D1 Fl I Li /usr/local/include:include
-.D1 \&
-searches first the directory where the \*[lang] program is found, next in
-.Pa /usr/local/include ,
-and finally in an
-.Pa include
-subdirectory of the directory from which
-.Nm
-was invoked.
.
.Ss Intrinsic functions
.Nm
@@ -1152,54 +1203,54 @@ others. They are listed alphabetically below.
.It
ABS ACOS ANNUITY ASIN ATAN
.It
-BASECONVERT BIT_OF BIT_TO_CHAR BOOLEAN_OF_INTEGER BYTE_LENGTH
+BASECONVERT BIT-OF BIT-TO-CHAR BOOLEAN-OF-INTEGER BYTE-LENGTH
.It
-CHAR CHAR_NATIONAL COMBINED_DATETIME CONCAT CONVERT COS CURRENT_DATE
+CHAR CHAR-NATIONAL COMBINED-DATETIME CONCAT CONVERT COS CURRENT-DATE
.It
-DATE_OF_INTEGER DATE_TO_YYYYMMDD DAY_OF_INTEGER DAY_TO_YYYYDDD DISPLAY_OF
+DATE-OF-INTEGER DATE-TO-YYYYMMDD DAY-OF-INTEGER DAY-TO-YYYYDDD DISPLAY-OF
.It
-E EXCEPTION_FILE
-EXCEPTION_FILE_N EXCEPTION_LOCATION EXCEPTION_LOCATION_N
-EXCEPTION_STATEMENT EXCEPTION_STATUS EXP EXP10
+E EXCEPTION-FILE
+EXCEPTION-FILE-N EXCEPTION-LOCATION EXCEPTION-LOCATION-N
+EXCEPTION-STATEMENT EXCEPTION-STATUS EXP EXP10
.It
-FACTORIAL FIND_STRING
-FORMATTED_CURRENT_DATE FORMATTED_DATE FORMATTED_DATETIME
-FORMATTED_TIME FRACTION_PART
+FACTORIAL FIND-STRING
+FORMATTED-CURRENT-DATE FORMATTED-DATE FORMATTED-DATETIME
+FORMATTED-TIME FRACTION-PART
.It
-HEX_OF HEX_TO_CHAR HIGHEST_ALGEBRAIC
+HEX-OF HEX-TO-CHAR HIGHEST-ALGEBRAIC
.It
-INTEGER INTEGER_OF_BOOLEAN INTEGER_OF_DATE INTEGER_OF_DAY
-INTEGER_OF_FORMATTED_DATE INTEGER_PART
+INTEGER INTEGER-OF-BOOLEAN INTEGER-OF-DATE INTEGER-OF-DAY
+INTEGER-OF-FORMATTED-DATE INTEGER-PART
.It
-LENGTH LOCALE_COMPARE
-LOCALE_DATE LOCALE_TIME LOCALE_TIME_FROM_SECONDS LOG LOG10 LOWER_CASE
-LOWEST_ALGEBRAIC
+LENGTH LOCALE-COMPARE
+LOCALE-DATE LOCALE-TIME LOCALE-TIME-FROM-SECONDS LOG LOG10 LOWER-CASE
+LOWEST-ALGEBRAIC
.It
-MAX MEAN MEDIAN MIDRANGE MIN MOD MODULE_NAME
+MAX MEAN MEDIAN MIDRANGE MIN MOD MODULE-NAME
.It
-NATIONAL_OF NUMVAL NUMVAL_C NUMVAL_F ORD
+NATIONAL-OF NUMVAL NUMVAL-C NUMVAL-F ORD
.It
-ORD_MAX ORD_MIN
+ORD-MAX ORD-MIN
.It
-PI PRESENT_VALUE
+PI PRESENT-VALUE
.It
RANDOM RANGE REM REVERSE
.It
-SECONDS_FROM_FORMATTED_TIME
-SECONDS_PAST_MIDNIGHT SIGN SIN SMALLEST_ALGEBRAIC SQRT
-STANDARD_COMPARE STANDARD_DEVIATION SUBSTITUTE SUM
+SECONDS-FROM-FORMATTED-TIME
+SECONDS-PAST-MIDNIGHT SIGN SIN SMALLEST-ALGEBRAIC SQRT
+STANDARD-COMPARE STANDARD-DEVIATION SUBSTITUTE SUM
.It
-TAN TEST_DATE_YYYYMMDD TEST_DAY_YYYYDDD TEST_FORMATTED_DATETIME
-TEST_NUMVAL TEST_NUMVAL_C TEST_NUMVAL_F TRIM
+TAN TEST-DATE-YYYYMMDD TEST-DAY-YYYYDDD TEST-FORMATTED-DATETIME
+TEST-NUMVAL TEST-NUMVAL-C TEST-NUMVAL-F TRIM
.It
-ULENGTH UPOS UPPER_CASE
+ULENGTH UPOS UPPER-CASE
USUBSTR USUPPLEMENTARY UUID4 UVALID UWIDTH
.It
VARIANCE
.It
-WHEN_COMPILED
+WHEN-COMPILED
.It
-YEAR_TO_YYYY
+YEAR-TO-YYYY
.El
.
.Ss Binary floating point DISPLAY
@@ -1279,7 +1330,7 @@ stores and converts
numbers. Converting the floating-point value to the numeric display
value 0055110 is done by multiplying 55.109999...\& by 1,000 and then
truncating the result to an integer. And it turns out that even
-though 55.11 can’t be represented in floating-point as an exact value,
+though 55.11 can't be represented in floating-point as an exact value,
the product of the multiplication, 55110, is an exact value.
.Pp
In cases where it is important for conversions to have predictable
@@ -1310,7 +1361,7 @@ specified for a calculation, then the intermediate result becomes a
.
.Ss A warning about binary floating point comparison
The cardinal rule when doing comparisons involving floating-point
-values: Never, ever, test for equality. It’s just not worth the hassle.
+values: Never, ever, test for equality. It's just not worth the hassle.
.Pp
For example:
.Bd -literal
@@ -1346,7 +1397,7 @@ and you really test the code. And then avoid it anyway.
.Pp
Finally, it is observably the case that the
.Nm
-implementations of floating-point conversions and comparisons don’t
+implementations of floating-point conversions and comparisons don't
precisely match the behavior of other \*[lang] compilers.
.Pp
You have been warned.