Skip to main content
Previous sectionNext section

ASCII

Converts a string from EBCDIC to ASCII.

Synopsis

ASCII(string)

Arguments

string An expression that resolves to a string.

Description

The ASCII function takes a string of characters and returns the EBCDIC code representation for each character. If you supply a string of EBCDIC code characters, ASCII returns the corresponding ASCII character(s). This is the inverse of the EBCDIC function. The string cannot contain Unicode characters.

The CHAR function takes an ASCII code and returns the corresponding character. The SEQ function takes a character and returns the corresponding ASCII code.

Examples

The following example uses the ASCII function to return the characters associated with the specified EBCDIC code string:

estring=EBCDIC("ABCDEFG")
astring=ASCII(estring)
PRINT astring
  ! returns "ABCDEFG"
Copy code to clipboard

The following example shows the use of the SEQ and CHAR functions with the ASCII function:

PRINT SEQ(EBCDIC("A"))
   ! returns 193
PRINT ASCII(CHAR(193))
   ! returns "A"
Copy code to clipboard

See Also