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 may 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 (`)

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 dynamically adapt 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 on 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. When the echo style is all or sysv, 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