Internationalization Support | The COBOL Interfacing Environment |
This chapter demonstrates NLS functionality by sorting a list of European place-names that include accented characters.
The NLS demonstration sorts the same list using the same code twice. The NLS Compiler directive is set for the first sort; it is set off (NONLS) for the second sort. The results of the two sorts are displayed together so you can compare the different sort sequences. In this demonstration, the list of names is encoded in two standard character sets: ISO 8859-1 and IBM PC. You need a terminal that can display one of these in order to run the demonstration. Providing that you set up the demonstration's copyfile correctly, (see the section Running the Sample Programs) the displayed results should be the same for both ISO 8859-1 and IBM PC character sets.
You need the following files to run the NLS sample programs:
nlsdemo.cbl | Source for main program and non-NLS subroutine |
nlssort.cbl | Source for the NLS subroutine |
sortsub.cpy | Copyfile of code common to both subroutines |
Use Infomgr to find these.
To run the NLS sample programs.
*78 charset value "ISO". 78 charset value "IBMPC".
cob nlsdemo.cbl nlssort.cbl
UNIX:
On UNIX, to use the ISO 8859-1 codeset for French, enter the
command line:
LANG=fr_FR export LANG
AIX:
On AIX, to use the IBM PC codeset for French, enter the command
line:
LANG=Fr_FR export LANG
cobrun nlsdemo
The results of the sorts are displayed on the screen. See the section Typical Results below for a sample of expected output from this sample program. If your results do not match those shown, the UNIX system files defining the collating sequence for that LANG environment variable setting might be non-standard. Your system administrator can modify these so that they give the expected results.
The table below shows the first 24 lines that are displayed on your screen as a result of sorting European place names containing accented characters. The left-hand column shows typical results for sorting the list without the NLS Compiler directive set (NONLS). The right-hand column shows typical results for sorting the list with the NLS Compiler directive set.
NONLS Compiler Directive | NLS Compiler Directive | ||
Aschaffenburg Bl3vands Huk Brìzová * Böda Chatel-Guyon Châlons S. Marne Château Thierry Châteauneuf en Thîm. Crèvecoeur le Gd. Cádiz Córdoba Föhr Göteborg Hj|rring La Campiña Leucate Lébn Lörrach Muhlhausen |
Munden
Munnerstadt Mys` gliborz * Málaga Mâcon Mâcon Mühldorf München Nice Nievre Nyköping Næstrved Nîmes Nürnberg Oddes Oslo Perusaic * Peñaranda Poznad * Roma |
Äland Älborg Aschaffenburg Blåvands Huk Böda Brìzová * Cádiz Châlons S. Marne Château Thierry Châteauneuf en Thîm. Chatel-Guyon Córdoba Crèvecoeur le Gd. Èáslav * Ètaples Föhr Göteborg Hjørring La Campiña |
Lébn
Leucate Lörrach Mâcon Mâcon Málaga Mühldorf Muhlhausen München münchen Munden Munnerstadt Mys` gliborz * Næstrved Nice Nievre Nîmes Nürnberg Nyköping Oddes |
Notes:
Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Internationalization Support | The COBOL Interfacing Environment |