Example: LANGUAGE option in a batch compilation
The following example shows the behavior of the LANGUAGE
compiler
option in a batch environment. The default installation option is ENGLISH
(abbreviated EN
),
and the invocation option is XX
, a nonexistent language.
CBL LANG(JP),FLAG(I,I),APOST (1)
IDENTIFICATION DIVISION. (2)
PROGRAM-ID. COMPILE1.
. . .
END PROGRAM COMPILE1.
CBL LANGUAGE(YY) (3)
CBL LANGUAGE(JP),LANG(!!) (4)
IDENTIFICATION DIVISION. (2)
PROGRAM-ID. COMPILE2.
. . .
END PROGRAM COMPILE2.
IDENTIFICATION DIVISION.
PROGRAM-ID. COMPILE3.
. . .
END PROGRAM COMPILE3.
CBL LANGUAGE(JP),LANGUAGE(YY) (5)
. . .
- (1)
- The installation default is
EN
. The invocation option wasXX
, a nonexistent language.EN
is the language in effect. - (2)
- After the
CBL
statement is scanned,JP
is the language in effect. - (3)
CBL
resets the language toEN
.YY
is ignored because it is superseded byJP
.- (4)
!!
is not alphanumeric and is discarded.- (5)
CBL
resets the language toEN
.YY
supersedesJP
but is nonexistent.
For the program COMPILE1
, the
default language English (EN
) is in effect when the
compiler scans the invocation options. A diagnostic message is issued
in mixed-case English because XX
is a nonexistent
language identifier. The default EN
remains in effect
when the compiler scans the CBL
statement. The unrecognized
option APOST
in the CBL
statement
is diagnosed in mixed-case English because the CBL
statement
has not completed processing and EN
was the last
valid language option. After the compiler processes the CBL
options,
the language in effect becomes Japanese (JP
).
In
the program COMPILE2
, the compiler diagnoses CBL
statement
errors in mixed-case English because English is the language in effect
before the first program is used. If more than one LANGUAGE
option
is specified, only the last valid language specified is used. In this
example, the last valid language is Japanese (JP
).
Therefore Japanese becomes the language in effect when the compiler
finishes processing the CBL
options. If you want
diagnostics in Japanese for the options in the CBL
and PROCESS
statements,
the language in effect before COMPILE1 must be Japanese.
The
program COMPILE3
has no CBL
statement.
It inherits the language in effect, Japanese (JP
),
from the previous compilation.
After compiling COMPILE3
,
the compiler resets the language in effect to English (EN
)
because of the CBL
statement. The language option
in the CBL
statement resolves the last-specified
two-character alphanumeric language identifier, YY.
Because YY
is
nonexistent, the language in effect remains English.