Skip to main content

EBCDIC

Converts a string from ASCII to EBCDIC.

Synopsis

EBCDIC(string)

Arguments

string An expression that resolves to a string.

Description

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

If string is a number, it is converted to canonical representation before EBCDIC processing. If string is a quoted numeric string, no conversion is performed before EBCDIC processing.

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 EBCDIC function to return the characters associated with the specified ASCII code string:

astring=ASCII("ABCDEFG")
estring=EBCDIC(astring)
PRINT estring
  ! returns "ABCDEFG"

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

PRINT SEQ(ASCII("A"))
   ! returns 159
PRINT EBCDIC(CHAR(159))
   ! returns "A"

See Also

FeedbackOpens in a new tab