Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Generating ASCII characters and strings by means of a compiler option

&pagelevel(4)&pagelevel

The C/C++ compiler generates code for characters and strings in EBCDIC format (default) or ASCII format, as required. You specify the format you want by means of the LITERAL-ENCODING option of the MODIFY-SOURCE-PROPERTIES .statement.

MODIFY-SOURCE-PROPERTIES ..., LITERAL-ENCODING=*NATIVE|*ASCII-FULL

LITERAL-ENCODING=*NATIVE

The compiler generates code for characters and strings in EBCDIC format.*NATIVE is the default.

LITERAL-ENCODING=*ASCII-FULL

The compiler generates code for characters and strings in ASCII format. In addition, the _LITERAL_ENCODING_ASCII preprocessor define is set to 1. Unless the _ASCII_SOURCE preprocessor define is set to 0 (see "Controlling the mapping of original functions to the associated ASCII variants"), the EBCDIC library functions are automatically mapped to the associated ASCII functions.

In POSIX you specify ASCII encoding by means of the following option:

-K literal_encoding_ascii_full

If you want to use ASCII support, you have to specify the MODIFY-MODULE-PROPERTIES statement as follows:

MODIFY-MODULE-PROPERTIES          -
...
LOWER-CASE-NAMES=*YES,            -
SPECIAL-CHARACTERS=*KEEP,         -
...

This prevents:

  • the names of the ASCII functions (see "C library functions that support ASCII encoding") from being truncated to eight characters

  • lowercase letters from being converted to uppercase and the character “_” from being replaced by “$” in the function names

In POSIX, you specify the following to achieve this:

-K llm_keep

-K llm_case_lower

Parameter transfer and environment variables

The LITERAL-ENCODING option also defines the format in which these strings are transferred to the main function. When LITERAL-ENCODING= *ASCII-FULL, the strings specified are consequently by default transferred to the main function in ASCII format. You can thus produce applications which have been ported to BS2000 or were originally generated as EBCDIC applications as ASCII applications without any need for intervention in the source code.