16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

If the shell command is operating on a character string and not on a byte string,<br />

and the shell is in a locale that supports DBCS, and if the utility encounters an<br />

invalid DBCS string, such as the ones described in this topic—you get an “illegal<br />

byte sequence” message and the utility may fail.<br />

Note: newline (\n [0x15]) causes the shift state of any subsequent character<br />

sequence to start in the initial state (shifted into the SBCS mode). This may<br />

apply when a command is processing a DBCS string and encounters<br />

newline before a “shift in.”<br />

For information on rules for creating DBCS data, refer to DBCS Design<br />

Guide—<strong>System</strong>/370 Software , GG18-9095.<br />

Displaying DBCS characters<br />

In a doublebyte environment, column positions are always based on the width of<br />

narrow characters. Normally, characters are “thin”; they take up only one column<br />

position when displayed. In contrast, some DBCS characters are “thick”; they take<br />

up two column positions when displayed.<br />

The number of actual characters that are displayed by the command in the column<br />

area depends on the thickness of the characters. This applies to such commands<br />

as ls, fold, and pr, which display DBCS characters in column positions.<br />

Switching locales<br />

By default, the shell starts in the P<strong>OS</strong>IX locale and cannot handle DBCS text until<br />

the locale is changed, typically with the shell command export LC_ALL=Ja_JP. This<br />

export command affects the current shell environment with the following exception:<br />

if you change the locale to DBCS, the shell’s LC_CTYPE locale category remains in<br />

the locale until is replaced via the exec command (exec /bin/sh).<br />

Even if you change the locale to DBCS by using export LC_ALL=Ja_JP, the shell’s<br />

LC_CTYPE variable remains in the previous locale (initially P<strong>OS</strong>IX) until the shell is<br />

exec’d again with exec sh.<br />

Always follow the export LC_ALL=your locale with exec sh to be sure the shell and<br />

utilities are running in the desired locale. This is true even if you place the export<br />

LC_ALL=your_locale in your login profile.<br />

Problems with filenames containing DBCS characters<br />

The file system treats all filenames as if they contained SBCS characters. However,<br />

when you use the shell in the DBCS locale, filename and pathname comparison is<br />

performed in wide mode. That is, all the characters in the name are converted to<br />

wide characters before comparison. By doing this, the shift codes are removed from<br />

the comparison and, therefore, a match can be found with the filenames.<br />

For example, if you have such DBCS filenames as:<br />

db/so dbfile1 si<br />

db/so dbfile2 si<br />

where so and si are the shift codes that shift out to DBCS and back to SBCS, then<br />

when in the DBCS locale (Ja_JP),<br />

ls db/so file si *<br />

lists both files.<br />

Chapter 1. Introduction to shell commands and DBCS 9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!