EbcdicToAscii (String function): Difference between revisions
m (→Syntax terms) |
m (→Examples) |
||
Line 51: | Line 51: | ||
Print %a:StringToHex | Print %a:StringToHex | ||
%e = '1
2' | %e = '1
2' | ||
%a = %e:EbcdicToAscii(CharacterDecode=True) | %a = %e:EbcdicToAscii(CharacterDecode=True) | ||
Print %a:StringToHex | Print %a:StringToHex | ||
%e = '©' | %e = '©' | ||
%a = %e:EbcdicToAscii(CharacterDecode=True) | %a = %e:EbcdicToAscii(CharacterDecode=True) | ||
Print %a:StringToHex | Print %a:StringToHex |
Latest revision as of 19:13, 6 November 2012
Convert EBCDIC string to ASCII (String class)
EbcdicToAscii is an intrinsic function that converts an EBCDIC string to ASCII (ISO 8859-1) using the current Unicode tables. Optionally, character references, entity references, and individual ampersand (&) references are converted to the represented ASCII character.
Syntax
%outString = string:EbcdicToAscii[( [CharacterDecode= boolean])] Throws CharacterTranslationException
Syntax terms
%outString | A string variable to receive the method object, string, translated to Ascii. |
---|---|
string | An EBCDIC character string. |
CharacterDecode | The optional (name required) CharacterDecode argument is a Boolean enumeration:
|
Exceptions
EbcdicToAscii can throw the following exception:
- CharacterTranslationException
- If the method encounters a translation problem, properties of the exception object may indicate the location and type of problem.
Usage notes
- EbcdicToAscii is available as of Sirius Mods version 7.3.
Examples
The following fragment shows calls of EbcdicToAscii against a variety of EBCDIC characters. The X constant function is used in the example.
%e string Len 20 %a string Len 20 %e = '12' %a = %e:EbcdicToAscii Print %a:StringToHex %e = '1
2' %a = %e:EbcdicToAscii(CharacterDecode=True) Print %a:StringToHex %e = '©' %a = %e:EbcdicToAscii(CharacterDecode=True) Print %a:StringToHex %e = 'F1FFF2':X %a = %e:EbcdicToAscii
The result is:
3132 310A32 A9 CANCELLING REQUEST: MSIR.0751: Class STRING, function EBCDICTOASCII: CHARACTER TRANSLATIONEXCEPTION exception: EBCDIC character X'FF' without valid translation to ASCII at byte position 2 ...
See also
- You can find the list of XHTML entities on the Internet at the following URL:
- There is more information about the Unicode tables.
- The inverse of the EbcdicToAscii method is AsciiToEbcdic.