z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


The LC_SYNTAX environment variable

z/OS UNIX System Services User's Guide
SA23-2279-00

There are 13 variant characters in the POSIX portable character set whose encoding might vary on different EBCDIC code pages:
  • Right brace (})
  • Left brace ({)
  • Backslash (\)
  • Right square bracket (])
  • Left square bracket ([)
  • Circumflex (^)
  • Tilde (~)
  • Exclamation point (!)
  • Pound sign (#)
  • Vertical bar (|)
  • Dollar sign ($)
  • Commercial at-sign (@)
  • Accent grave (`)

Before MVS SP Release 5.2.2, the z/OS® shell and utilities required that all data in the z/OS UNIX file system be encoded in one of three code pages: IBM-1047, IBM-1027, or IBM-939. Any data moved into the z/OS UNIX file system from a workstation or from an MVS™ data set often had to be converted to one of code pages IBM-1047, IBM-1027, or IBM-939 before it could be processed by the shell. Similarly, to ensure that any variant characters keyed in at the terminal had the correct encoding, you had to either use the conversion option of the OMVS command or customize your keyboard.

Now, however, the shell can process data in additional EBCDIC code pages, not just the three code pages previously supported. When you specify a locale with the LC_ALL variable, the LC_SYNTAX environment variable is set. The shell uses the LC_SYNTAX environment variable to determine the code points to use for the 13 variant characters. This means that the shell can adapt dynamically to the code page of the current locale.

Applications that use LC_SYNTAX will work in multiple locales using multiple code pages. To be sensitive to the 13 variant characters, an application must be enabled to use LC_SYNTAX. For information about how to do this, see z/OS XL C/C++ Programming Guide.

LC_SYNTAX—an example

For example, consider the echo command and its use of the backslash (\) character. The backslash is one of the 13 variant characters. The following command:
echo 'this is\nreal handy'
produces the following output at the terminal:
this is
real handy
echo finds and converts the \n in the input to a <newline> character in the output. To do this, echo must know the encoding for the backslash character in the current user's environment—in this case, the character generated by the user's terminal when the backslash key is pressed.

A 3270 terminal operating in the USA locale En_US.IBM-037 (code page IBM-037) generates X'E0' for the backslash, while a 3270 terminal operating in the German locale De_DE.IBM-273 (code page IBM-273) generates X'EC'. The LC_SYNTAX locale category provides this locale-specific hexadecimal encoding information to echo and the other utilities.

When the USA user runs in locale En_US.IBM-037, echo determines from the LC_SYNTAX information in this locale that the expected encoding for backslash is X'E0'. Likewise, when the German user runs in locale De_DE.IBM-273, echo determines from the LC_SYNTAX information in this locale that the expected encoding for backslash is X'EC'.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014