\chapter{Compiler directives}

\section{CALL-CONVENTION directive}

\begin{syntax}
  \directiveindicator\key{CALL-CONVENTION}
  \begin{1=}
    \key{COBOL} \\
    \key{EXTERN} \\
    \key{STDCALL} \\
    \key{STATIC}
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{*CONTROL statement}

\begin{syntax}[\miscextcolour]
  \pending{
    \begin{1=}
      *\key{CBL} \\
      *\key{CONTROL}
    \end{1=}
    \begin{1=}
      \key{SOURCE} \\
      \key{NOSOURCE} \\
      \key{LIST} \\
      \key{NOLIST} \\
      \key{MAP} \\
      \key{NOMAP}
    \end{1=}
  }
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{COPY statement}

\begin{syntax}
  \begin{1=}
    \key{COPY} \\
    \deleted{\key{INCLUDE}}
  \end{1=}
  \begin{1=}
    \literal \\
    \textname \\
  \end{1=}
  \begin{0-1}
    \begin{1=}
      \key{IN} \\
      \key{OF}
    \end{1=}
    \begin{1=}
      \literal \\
      \libraryname
    \end{1=}
  \end{0-1}

  \begin{0-1}
    \key{SUPPRESS} PRINTING
  \end{0-1}

  \begin{0-1}
    \key{REPLACING}
    \begin{1=}
      \begin{1=}
        == \pseudotext == \\
        \identifier \\
        \literal
      \end{1=}
      \key{BY}
      \begin{1=}
        == \pseudotext == \\
        \identifier \\
        \literal
      \end{1=} \\

      \begin{1=}
        \key{LEADING} \\
        \key{TRAILING}
      \end{1=}
      == \metaelement{partial-word-1} ==
      \key{BY}
      == \metaelement{partial-word-2} ==
    \end{1=}\ldots
  \end{0-1}
  .
\end{syntax}


\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{D directive}

\begin{syntax}[\miscextcolour]
  \directiveindicator\key{D} \sourcetext
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{DEFINE directive}

\begin{syntax}
  \begin{1=}
    \directiveindicator \\
    \miscext{\textdollar}
  \end{1=}
  \key{DEFINE}
  \gnucobol{
    \begin{0-1}
      \key{CONSTANT}
    \end{0-1}
  }
  \metaelement{compilation-variable-1} AS
  \begin{1=}
    \begin{1=}
      \literal \\
      \key{PARAMETER}
    \end{1=}
    \begin{0-1}
      \key{OVERRIDE}
    \end{0-1} \\
    \key{OFF}
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{DISPLAY directive}

\format{general}
\begin{syntax}[\miscextcolour]
  \begin{1=}
    \gnucobol{\directiveindicator} \\
    \textdollar
  \end{1=}
  \key{DISPLAY} \sourcetext
\end{syntax}

\format{vcs}
\begin{syntax}[\miscextcolour]
  \pending{
    \textdollar\key{DISPLAY} \key{VCS} = \metaelement{version-string}
  }
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{EJECT statement}

\begin{syntax}[\miscextcolour]
  \pending{\key{EJECT}}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{IF directive}

\begin{syntax}
  \begin{1=}
    \directiveindicator \\
    \miscext{\textdollar}
  \end{1=}
  \key{IF} \metaelement{compilation-variable-1} IS NOT
  \begin{1=}
    \key{DEFINED} \\
    \key{SET} \\
    relation \\
    \metaelement{compilation-variable-2}
  \end{1=}

  \sourcetext

  \miscext{
    \begin{0-1}
      \begin{1=}
        \gnucobol{\directiveindicator} \\
        \textdollar
      \end{1=}
      \begin{1=}
        \key{ELIF} \\
        \key{ELSE-IF}
      \end{1=}
      \condition
      \sourcetext
    \end{0-1} \ldots
  }

  \begin{0-1}
    \begin{1=}
      \directiveindicator \\
      \miscext{\textdollar}
    \end{1=}
    \key{ELSE} \sourcetext
  \end{0-1}

  \begin{0-1}
    \directiveindicator\key{END-IF} \\
    \miscext{\textdollar\key{END}} \\
    \miscext{\textdollar\key{END-IF}}
  \end{0-1}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{LEAP-SECOND directive}

\begin{syntax}
  \pending{\directiveindicator\key{LEAP-SECOND}}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{LISTING directive}

\begin{syntax}
  \directiveindicator\key{LISTING}
  \begin{1=}
    \key{ON} \\
    \key{OFF}
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{@OPTIONS directive}

\begin{syntax}[\miscextcolour]
  \pending{
    \key{@OPTIONS}
    \begin{0-1}
      \metaelement{options-text}
    \end{0-1}
  }
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{PAGE directive}

\begin{syntax}
  \directiveindicator\key{PAGE}
  \begin{0-1}
    \metaelement{comment-text}
  \end{0-1}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{PROCESS statement}

\begin{syntax}[\miscextcolour]
  \pending{\key{PROCESS}}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{REF-MOD-ZERO-LENGTH directive}

\begin{syntax}
  \directiveindicator\key{REF-MOD-ZERO-LENGTH}
  \begin{0-1}
    \key{ON} \\
    \key{OFF}
  \end{0-1}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{REPLACE statement}

\format{on}
\begin{syntax}
  \key{REPLACE}
  \begin{0-1}
    \key{ALSO}
  \end{0-1}
  \begin{1=}
    \begin{1=}
      == \pseudotext == \\
      \identifier
    \end{1=}
    \key{BY}
    \begin{1=}
      == \pseudotext == \\
      \identifier
    \end{1=} \\

    \begin{1=}
      \key{LEADING} \\
      \key{TRAILING}
    \end{1=}
    == \metaelement{partial-word-1} ==
    \key{BY}
    == \metaelement{partial-word-2} ==
  \end{1=}\ldots .
\end{syntax}

\format{off}
\begin{syntax}
  \key{REPLACE}
  \begin{0-1}
    \key{LAST}
  \end{0-1}
  \key{OFF}.
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{SET directive}

\begin{syntax}[\miscextcolour]
  \begin{1=}
    \gnucobol{\directiveindicator} \\
    \textdollar
  \end{1=}
  \key{SET}
  \begin{1=}
    \gnucobol{
      \key{CONSTANT} \metaelement{compilation-variable-1} \literal
    } \\

    \gnucobol{
      \key{XFD} \literal
    } \\

    \gnucobol{
      \metaelement{compilation-variable-2}
      \begin{0-1}
        \literal
      \end{0-1}
    } \\

    \metaelement{micro-focus-directive}
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{SKIP1 statement}

\begin{syntax}[\miscextcolour]
  \pending{\key{SKIP1}}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{SKIP2 statement}

\begin{syntax}[\miscextcolour]
  \pending{\key{SKIP2}}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{SKIP3 statement}

\begin{syntax}[\miscextcolour]
  \pending{\key{SKIP3}}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{SOURCE directive}

\begin{syntax}
  \directiveindicator\key{SOURCE} FORMAT IS
  \begin{1=}
    \key{FIXED} \\
    \key{FREE} \\
    \gnucobol{\key{VARIABLE}}
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{TITLE statement}

\begin{syntax}[\miscextcolour]
  \key{TITLE} \literal
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{TURN directive}

\begin{syntax}
  \directiveindicator\key{TURN}
  \begin{1=}
    exception-name-1
  \end{1=} \ldots
  \key{CHECKING}
  \begin{1=}
    \key{ON}
    \begin{0-1}
      WITH \key{LOCATION}
    \end{0-1} \\

    \key{OFF}
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{Micro Focus directives}

\subsection{ADDRSV directive}

\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{ADDRSV} \\
    \key{ADD-RSV}
  \end{1=}
  \literal \dots % TO-DO: Replace with MF-directive-literal
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{ADDSYN directive}

\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{ADDSYN} \\
    \key{ADD-SYN}
  \end{1=}
  \literal = \literal
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{ASSIGN directive}

\begin{syntax}[\miscextcolour]
  \key{ASSIGN}
  \begin{1=}
    "EXTERNAL" \\
    "DYNAMIC"
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{BOUND directive}

\format{enable}
\begin{syntax}[\miscextcolour]
  \key{BOUND} \\
\end{syntax}

\format{disable}
\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{NOBOUND} \\
    \key{NO-BOUND}
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{CALLFH directive}

\begin{syntax}[\miscextcolour]
  \key{CALLFH}
  \begin{0-1}
    \literal
  \end{0-1}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{CHECKNUM directive}

\format{enable}
\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{CHECKNUM} \\
    \key{CHECK-NUM}
  \end{1=}
\end{syntax}

\format{disable}
\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{NOCHECKNUM} \\
    \key{NO-CHECKNUM} \\
    \key{NO-CHECK-NUM}
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{COMP1 directive}

\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{COMP1} \\
    \key{COMP-1}
  \end{1=}
  \begin{1=}
    "BINARY" \\
    "FLOAT"
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{FOLDCOPYNAME directive}

\format{enable}
\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{FOLDCOPYNAME} \\
    \key{FOLD-COPY-NAME}
  \end{1=}
  \gnucobol{AS}
  \begin{1=}
    "UPPER" \\
    "LOWER"
  \end{1=}
\end{syntax}

\format{disable}
\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{NOFOLDCOPYNAME} \\
    \key{NOFOLD-COPY-NAME} \\
    \key{NO-FOLD-COPY-NAME}
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{MAKESYN directive}

\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{MAKESYN} \\
    \key{MAKE-SYN}
  \end{1=}
  \literal = \literal
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{OVERRIDE directive}

\begin{syntax}[\miscextcolour]
  \key{OVERRIDE}
  \begin{1=}
    \literal = \literal
  \end{1=} \dots
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{REMOVE directive}

\begin{syntax}[\miscextcolour]
  \key{REMOVE} \literal \dots
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{SPZERO directive}

\format{enable}
\begin{syntax}[\miscextcolour]
  \pending{
    \key{SPZERO}
  }
\end{syntax}

\format{disable}
\begin{syntax}[\miscextcolour]
  \pending{
    \begin{1=}
      \key{NOSPZERO} \\
      \key{NO-SPZERO}
    \end{1=}
  }
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{SOURCEFORMAT directive}

\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{SOURCEFORMAT} \\
    \key{SOURCE-FORMAT}
  \end{1=}
  \begin{1=}
    "FIXED" \\
    "FREE" \\
    "VARIABLE"
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\subsection{SSRANGE directive}

\format{enable}
\begin{syntax}[\miscextcolour]
  \key{SSRANGE}
  \begin{0-1}
    "1" \\
    "2" \\
    "3"
  \end{0-1}
\end{syntax}

\format{disable}
\begin{syntax}[\miscextcolour]
  \begin{1=}
    \key{NOSSRANGE} \\
    \key{NO-SSRANGE}
  \end{1=}
\end{syntax}

\subsubsection{Syntax rules}

\subsubsection{General rules}

\section{Predefined compilation variables}

GnuCOBOL defines compilation variables when certain conditions are true. If the condition associated with a variable is false, the variable is not defined.

\begin{centering}
  \begin{longtable}[!h]{p{0.2\textwidth} p{0.7\textwidth}}
    \toprule
    \textbf{Name} & \textbf{Condition} \\

    \midrule
    DEBUG & The -d debug flag is specified. \\

    EXECUTABLE & The 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:
    \begin{itemize}
    \item 1--2, the item has 1 byte
    \item 3--4, the item has 2 bytes
    \item 5--9, the item has 4 bytes
    \item 10--18, the item has 8 bytes.
    \end{itemize} \\

    GNUCOBOL & GnuCOBOL is compiling the source unit. \\

    HOSTSIGNS & A \emph{signed} packed-decimal item's value may be considered NUMERIC if the sign has value X"F". \\

    IBMCOMP & The size of a COMP item is determined according to the IBM scheme, where for a PICTURE of length:
    \begin{itemize}
    \item 1--4, the item has 2 bytes
    \item 5--9, the item has 4 bytes
    \item 10--18, the item has 8 bytes.
    \end{itemize} \\

    MODULE & The module being compiled does not contain the main program. \\

    NOHOSTSIGNS & A \emph{signed} packed-decimal item's value may not be considered NUMERIC if the sign has value 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 enabled. \\

    NOTRUNC & Numeric data items are truncated according to their internal representation. \\

    OCCOMP & The size of a COMP item is determined according to the GnuCOBOL scheme, where for a PICTURE of length:
    \begin{itemize}
    \item 1--2, the item has 1 byte
    \item 3--4, the item has 2 bytes
    \item 5--9, the item has 4 bytes
    \item 10--18, the item has 8 bytes.
    \end{itemize} \\

    OPENCOBOL & GnuCOBOL is compiling the source unit. \\

    P64 & Pointers are greater than 32 bits long. \\

    STICKY-LINKAGE & Sticky-linkage (linkage-section items remaining allocated between invocations) is enabled. \\

    TRUNC & Numeric data items are truncated according to their PICTURE clauses. \\
    \bottomrule
  \end{longtable}
\end{centering}


%%% Local Variables:
%%% mode: latex
%%% TeX-master: "grammar.tex"
%%% End:
