The DISPLAY-OF function returns a string which contains the characters of the argument converted into alphanumeric representation.
The type of this function is national.
Format
FUNCTION
NATIONAL-OF
(argument-1 [argument-2])
Arguments
argument-1 must be of the class alphabetic or alphanumeric and at least one character long.
argument-1 may not be defined with the ANY LENGTH clause.
argument-2 must be of the class national and precisely one character long.
When conversion takes place in the result, argument-2 specifies a replacement character in place of the alphanumeric characters for which there is no corresponding national character.
Returned values
As a return value a string is supplied in which each alphanumeric character from argument-1 is converted into its corresponding character in national representation.
If argument-2 is specified, each character from argument-1 for which no corresponding character exists in national representation is converted into the replacement character specified by argument-2.
If argument-2 is not specified and argument-1 contains characters for which no corresponding character exists in national representation, these are converted into a replacement character defined by XHCS (period ’.’). The exceptional condition EC-DATA-CONVERSION occurs.
The return value contains exactly as many characters as argument-1.
The error return value is a blank.
If FUNCTION NATIONAL-OF is contained as a sending field in a MOVE statement for which the check for the exceptional condition EC-DATA-CONVERSION is enabled and a USE procedure also exists, the receiving item remains unchanged if the exceptional condition occurs. A MOVE statement with implicit conversion is the opposite of this.
See also: DISPLAY-OF
Example 9-30
... DATA DIVISION. WORKING-STORAGE SECTION. 01 alfa PIC XXX VALUE "ABC". 01 R PIC NNN. PROCEDURE DIVISION. MAIN. MOVE FUNCTION NATIONAL-OF (alfa) TO R. STOP RUN.
Result: R contains the characters ABC in UTF-16 representation.