1 CDF
When the compiler is operating in Fixed Format Mode, all CDF statements must begin in column eight (8) or beyond.
There are two types of supported CDF statements in GnuCOBOL — Text Manipulation Statements and Compiler Directives.
The CDF text manipulation statements COPY and REPLACE are used to introduce new code into programs either with or without changes, or may be used to modify existing statements already in the program. Text manipulation statements are always terminated with a period.
CDF directives, denoted by the presence of a “>>” character sequence as part of the statement name itself, are used to influence the process of program compilation.
Compiler directives are never terminated with a period.
CDF CALL-CONVENTION Statement Syntax
>>CALL-CONVENTION { COBOL }
~~~~~~~~~~~~~~~~~ { EXTERN }
{ STDCALL }
{ STATIC }
CDF COPY Statement Syntax
COPY copybook-name
~~~~
[ IN|OF library-name ]
~~ ~~
[ SUPPRESS PRINTING ]
~~~~~~~~
[ REPLACING { Phrase-Clause | String-Clause }... ] .
~~~~~~~~~
CDF COPY Phrase-Clause Syntax
{ ==pseudo-text-1== } BY { ==pseudo-text-2== }
{ identifier-1 } ~~ { identifier-2 }
{ literal-1 } { literal-2 }
{ word-1 } { word-2 }
CDF COPY String-Clause Syntax
[ LEADING|TRAILING ] ==partial-word-1== BY ==partial-word-2==
~~~~~~~ ~~~~~~~~ ~~
CDF REPLACE Statement (Format 1) Syntax
REPLACE [ ALSO ] { Phrase-Clause | String-Clause }... .
~~~~~~~ ~~~~
CDF REPLACE Statement (Format 2) Syntax
REPLACE [ LAST ] OFF .
~~~~~~~ ~~~~ ~~~
CDF REPLACE Phrase-Clause Syntax
{ ==pseudo-text-1== } BY { ==pseudo-text-2== }
~~
CDF REPLACE String-Clause Syntax
[ LEADING|TRAILING ] ==partial-word-1== BY ==partial-word-2==
~~~~~~~ ~~~~~~~~ ~~
CDF >>DEFINE Directive Syntax
>>DEFINE [ CONSTANT ] cdf-variable-1 AS { OFF }
~~~~~~~~ ~~~~~~~~ { ~~~ }
{ literal-1 [ OVERRIDE ] }
{ ~~~~~~~~ }
{ PARAMETER [ OVERRIDE ] }
~~~~~~~~~ ~~~~~~~~
CDF >>IF Directive Syntax
>>IF CDF-Conditional-Expression-1
~~~~ [ Program-Source-Lines-1 ]
[ >>ELIF CDF-Conditional-Expression-2
~~~~~~ [ Program-Source-Lines-2 ] ]...
[ >>ELSE
~~~~~~ [ Program-Source-Lines-3 ] ]
>>END-IF
~~~~~~~~
CDF-Conditional-Expression Syntax
{ cdf-variable-1 } IS [ NOT ] { DEFINED }
{ literal-1 } ~~~ { ~~~~~~~ }
{ SET }
{ ~~~ }
{ CDF-RelOp { cdf-variable-2 } }
{ { literal-2 } }
CDF-RelOp Syntax
>= or GREATER THAN OR EQUAL TO
~~~~~~~ ~~ ~~~~~
> or GREATER THAN
~~~~~~~
<= or LESS THAN OR EQUAL TO
~~~~ ~~ ~~~~~
< or LESS THAN
~~~~
= or EQUAL TO
~~~~~
<> or EQUAL TO (with "NOT")
~~~~~
CDF >>SET Directive Syntax
>>SET { [ CONSTANT ] cdf-variable-1 literal-1 ] }
~~~~~ { ~~~~~~~~ }
{ SOURCEFORMAT AS FIXED|FREE|VARIABLE|XOPEN|XCARD|CRT|TERMINAL|COBOLX }
{ ~~~~~~~~~~~~ ~~~~~ ~~~~ ~~~~~~~~ ~~~~~ ~~~~~ ~~~ ~~~~~~~~ ~~~~~~ }
{ NOFOLDCOPYNAME }
{ ~~~~~~~~~~~~~~ }
{ FOLDCOPYNAME AS UPPER|LOWER }
~~~~~~~~~~~~ ~~~~~ ~~~~~
CDF >>SOURCE Directive Syntax
>>SOURCE FORMAT IS { FIXED|FREE|VARIABLE|XOPEN|XCARD|CRT|TERMINAL|COBOLX }
~~~~~~~~ ~~~~~ ~~~~ ~~~~~~~~ ~~~~~ ~~~~~ ~~~ ~~~~~~~~ ~~~~~~
CDF >>TURN Directive Syntax
>>TURN { exception-name-1 [ file-name-1 ]... }...
~~~~~~
{ OFF }
{ ~~~ }
{ CHECKING ON [ WITH LOCATION ] }
~~~~~~~~ ~~ ~~~~~~~~
CDF >>D Directive Syntax
>>D
~~~
CDF >>DISPLAY Directive Syntax
>>DISPLAY source-text [ VCS = version-string ]
~~~~~~~~~ ~~~
CDF >>PAGE Directive Syntax
>>PAGE [ comment-text ]
~~~~~~
CDF >>LISTING Directive Syntax
>>LISTING {ON}
~~~~~~~~~ {OFF}
CDF >>LEAP-SECONDS Directive Syntax
>>LEAP-SECONDS
~~~~~~~~~~~~~~
The >>LEAP-SECONDS
CDF directive is syntactically recognized but is otherwise non-functional.
CDF $ Directives Syntax
$ (Dollar) Directives - Active.
These directives are active and have the same function as ones starting with >>:
$DEFINE
$DISPLAY ON|OFF
$IF
$ELIF
$ELSE
$ELSE-IF
$END
$SET
It is recommended to use the standard directives only instead of the MF
directives (when possible) as these have a higher chance for being portable.
$ (Dollar) Directives - Not Active.
These are NOT active and will produce a warning message:
$DISPLAY VCS ...
Recognised but otherwise ignored.
@OPTIONS options-text
Additional Micro-Focus directives accepted :
ADDRSV | ADD-RSV literal-1
ADDSYN | ADD-SYN literal-1 = literal-2
ASSIGN "EXTERNAL" | "DYNAMIC"
BOUND
CALLFH literal-1
COMP1 | COMP-1 "BINARY" | "FLOAT"
FOLDCOPYNAME | FOLD-COPY-NAME AS "UPPER" | "LOWER"
MAKESYN | MAKE-SYN
NOBOUND | NO-BOUND
NOFOLDCOPYNAME | NOFOLD-COPY-NAME | NO-FOLD-COPY-NAME
OVERRIDE literal-1 = literal-2
REMOVE literal-1
SOURCEFORMAT | SOURCE-FORMAT "FIXED" | "FREE" | "VARIABLE"
SSRANGE "2"
NOSSRANGE | NO-SSRANGE
CDF Predefined Compilation Variables Syntax
GnuCOBOL defines compilation variables when various conditions are true.
If the condition associated with a variable is false, the variable is not defined.
DEBUG The -d debug flag is specified.
EXECUTABLE Module being compiled contains the main program.
GCCOMP The size of a COMP item is determined according to the GnuCOBOL scheme,
where for a picture of length:
1 - 2, item = 1 byte
3 - 4, item = 2 bytes
5 - 9, item = 4 bytes
10 - 18, item = 8 bytes.
GNUCOBOL GnuCOBOL is compiling the source unit.
HOSTSIGNS A signed packed decimal item's value may be considered NUMERIC if
sign = X"F".
IBMCOMP The size of a COMP item is determined according to the IBM scheme,
where for a PICTURE of length :
1 - 4, item = 2 bytes
5 - 9, item = 4 bytes
10 - 18, item = 8 bytes.
MODULE The element being compiled does not contain the main program.
NOHOSTSIGNS A signed packed decimal item's value may NOT be considered
NUMERIC if sign = X"F".
NOIBMCOMP The size of a COMP item is NOT determined according to the IBM scheme.
NOSTICKY-LINKAGE
Sticky linkage (linkage section items remaining allocated between
invocations) is NOT active.
NOTRUNC Numeric data items are truncated according to their internal
representation.
P64 Pointers are greater than 32 bits.
STICKY-LINKAGE
Sticky linkage (linkage section items remaining allocated between
invocations) is active.
TRUNC Numeric data items are truncated according to their PICTURE clauses.
These, while still supported may well be removed in the future and should not be
used. See GCCOMP and GNUCOBOL instead:
OCCOMP The size of a COMP item is determined according to the GnuCOBOL scheme,
where for a PICTURE of length :
1 - 2, item = 1 byte
3 - 4, item = 2 bytes
5 - 9, item = 4 bytes
10 - 18, item = 8 bytes.
OPENCOBOL GnuCOBOL is compiling the source unit.