NATIONAL-OF

The NATIONAL-OF function returns a national character string consisting of the national character representation of the characters in argument-1.

The type of the function is national.

Read syntax diagramSkip visual syntax diagram
Format

>>-FUNCTION NATIONAL-OF--(--argument-1--+------------+--)------><
                                        '-argument-2-'      

argument-1
Must be of class alphabetic, alphanumeric, or DBCS. argument-1 specifies the source string for the conversion.
argument-2
Must be an integer or of class alphanumeric. argument-2 identifies the source code page for the conversion.

If argument-2 is of class alphanumeric, it must identify a primary or alias code-page name that is supported by ICU conversion libraries (see International Components for Unicode: Converter Explorer).

If argument-2 is an integer, the integer must be a valid CCSID number.

If argument-2 is omitted, the source code page is determined as follows:

  • If argument-1 is a native item (USAGE DISPLAY or USAGE DISPLAY-1 containing ASCII or ASCII DBCS, EUC, or UTF-8 data), the source code page is determined from the runtime locale.
  • If argument-1 is a USAGE DISPLAY or USAGE DISPLAY-1 item containing EBCDIC or EBCDIC DBCS data, the source code page is determined from the EBCDIC_CODEPAGE environment variable, if it is set. If the EBCDIC_CODEPAGE environment variable is not set, the source code page is the default code page specified in the Locales and code pages that are supported in the COBOL for AIX Programming Guide.

The returned value is a national character string consisting of the characters of argument-1 converted to national character representation. When a source character cannot be converted to a national character, the source character is converted to a substitution character. The substitution character is:

No exception condition is raised.

The length of the returned value depends on the content of argument-1 and the characteristics of the source code page.

Usage notes:

Exception: If the conversion fails, a severe runtime error occurs.