Chapter Contents

Previous

Next
Porting UNIX Socket Applications to the SAS/C Environment

Character Sets

EBCDIC-to-ASCII translation is one of the greatest sources of socket program incompatibility. When communicating with a program in almost any environment other than OS/390 and CMS, text must be translated from EBCDIC into ASCII. If all transmitted data were text, the SAS/C Library could translate text automatically to ASCII before sending the data, and it could translate the text to EBCDIC automatically when receiving data. Unfortunately, only the program knows which data are text and which data are binary. Therefore, the program must be responsible for the translation.

The SAS/C Library provides the htoncs and ntohcs routines to facilitate EBCDIC-to-ASCII translation. ASCII is the character set used in network text transmission. The htoncs and ntohcs routines are not portable to UNIX, but you can define them as null function-like macros for environments other than CMS and OS/390. You can recompile these routines if you want to use a different EBCDIC-to-ASCII translation method.

Note that, except when using the resolver (see the following section, The Resolver, for more information), the SAS/C Library does not perform any translations from ASCII to EBCDIC.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.