Using Enhanced ASCII

Enhanced ASCII introduces automatic conversion which, in some cases, is an alternative to iconv. z/OS® UNIX System Services Porting Guide contains examples of automatic conversion. The enhanced ASCII functionality makes it easier to port internationalized applications developed on ASCII platforms, or for them, to z/OS platforms by providing conversion from ASCII to EBCDIC, and from EBCDIC to ASCII. Enhanced ASCII also provides support for file tagging. File tags are a way to identify the code set of text data within files and are used during automatic conversion.

Enhanced ASCII provides limited conversion of ASCII to EBCDIC, and EBCDIC to ASCII. The character set or alphabet that is associated with any locale consists of the following:
  • A common, XPG4-defined subset of characters such as POSIX portable characters
  • A unique, locale-specific subset of characters such as NLS characters

Restriction: The conversion only applies to the portable subset of characters that are associated with a locale. Only the EBCDIC IBM-1047 encoding of portable characters is supported.

You might encounter unexpected results in the following situations:
  • If Enhanced ASCII applications run in locales that contain non-Latin Alphabet Number 1 characters, C-RTL functions might copy some of the locale's non-Latin 1 characters into buffers that the application is writing to stdout or another file. The non-Latin Alphabet Number 1 characters would then cause problems during automatic conversion.
  • Language Environment® applications might select non-English message files. If the NATLANG runtime option is not ENU or UEN, then conversion does not take place. The messages are presented to the file system write routine in EBCDIC, before any automatic conversion takes place. If the automatic conversion is to EBCDIC, then there will be a problem because EBCDIC cannot be converted to EBCDIC.

A subset of C headers and functions is provided in ASCII. For a list of all C/C++ runtime library functions that support Enhanced ASCII, see z/OS XL C/C++ Language Reference.

The only way to get to the ASCII version of functions and the external variables environ and tzname is to use the appropriate IBM® header files. ASCII applications may read, but not update, environment variables using the environ external variable. Updates to the environment variables using environ in an ASCII application causes unpredictable results and might result in an abend. Language Environment maintains two equivalent arrays of environment variables when running an ASCII application, one with EBCDIC encodings and the other with ASCII encodings. All ASCII compile units that use the environ external variable must include <stdlib.h> so that environ can be mapped to access the ASCII encoded environment strings. If <stdlib.h> is not included, environwill refer to the EBCDIC representation of the environment variable strings.

To execute ASCII shell scripts and REXX execs, use spawn (BPX1SPN).