NLS Directive [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Reference
NLS Directive
The NLS (Native Language Support) directive supports special processing
to handle foreign language text and data.
Syntax
$NLS [LITERALS] [ON ]
[COMPARE ] [OFF]
ON turns on both LITERALS and COMPARE.
OFF turns off all NLS processing. By default, the
Native-Computer character set and collating sequence
is used.
LITERALS enables the handling of native language characters in
strings and comments during compilation of a source
program. Run-time native language I/O is also
enabled.
COMPARE enables all operators that deal with string
comparisons (LGE, LGT, LLE, LLT) to compare string
variables and string constants using the collating
sequence corresponding to the specified NLDATALANG
JCW. Run-time native language I/O is also enabled.
Default Off; the Native-Computer character set and
collating sequence is used.
Location The NLS directive must appear before any
nondirective statements in a program unit.
Toggling/ Duration Cannot be toggled after the appearance of
nondirective statements in a program unit.
Impact on Using the LITERALS option decreases compile time
Performance performance.
Additional Information
NOTE $NLS LITERALS replaces the NLS_SOURCE compiler directive. Any
occurrences of $NLS_SOURCE in FORTRAN source programs should be
replaced with $NLS LITERALS.
To use the NLS directive, NLUSERLANG and NLDATALANG must be set.
NLDATALANG determines the language used for string comparisons and
scanning FORTRAN source programs. NLUSERLANG determines the language
used to output compiler error messages. For example, to set NLDATALANG
and NLUSERLANG, specify the following:
:SETJCW NLDATALANG 221
:SETJCW NLUSERLANG 0
In the example above, 221 is the JCW value for Japanese and zero is the
JCW value of Native-Computer (the default value). Refer to the Native
Language Programmer's Guide for a complete list of JCW values.
Examples
Following is a FORTRAN source file called test:
$NLS ON
PROGRAM testnls
CHARACTER*10 st1,st2
st1 = 'coin'
st2 = 'change'
IF (LLT(st1,st2)) PRINT *,'This is the Spanish language.'
IF (LGT(st1,st2)) PRINT *,'This is the English language.'
STOP
END
Following are examples of setting the MPE JCWs for test, followed by the
output from the program for each setting:
:SETJCW NLUSERLANG 0 Tells the compiler to print compile-time messages using the default message catalog.
:SETJCW NLDATALANG 12 Tells the compiler to do lexical comparisons in Spanish and to expect Spanish characters in the
source file.
:FTNiXLK TEST
:SAVE $OLDPASS,NLSPROG
:NLSPROG
Output:
This is the Spanish language.
:SETJCW NLDATALANG 0
:NLSPROG
Output:
This is the English language.
NOTE The Spanish alphabet has both the letters "c" and "ch". Because
"c" comes before "ch" in the Spanish alphabet, coin is considered
to be lexically less than change. In English, change is considered
to be lexically less than coin.
MPE/iX 5.0 Documentation