AsciiToEbcdic (String function): Difference between revisions
m (re-match syntax diagram to revised template; fix tags. Still some link targets thatneed to be writtend / defined / found.) |
m (how did I miss those tags) |
||
Line 28: | Line 28: | ||
==Examples== | ==Examples== | ||
<ol><li> | <ol><li> | ||
The following fragment shows calls of <var>AsciiToEbcdic</var> against strings with and without non-translatable characters | The following fragment shows calls of <var>AsciiToEbcdic</var> against strings with and without non-translatable characters. | ||
<p class="code">%a | <p class="code">%a string Len 20 | ||
%a = '31':X | %a = '31':X | ||
Print %a: | Print %a:AsciiToEbcdic | ||
%a = '318132':X | %a = '318132':[[X (String function)|X]] | ||
Print %a: | Print %a:AsciiToEbcdic(CharacterEncode=True) | ||
Print %a: | Print %a:AsciiToEbcdic | ||
</p> | </p> | ||
The result is: | The result is: | ||
Line 45: | Line 45: | ||
</p> | </p> | ||
</ol> | </ol> | ||
==See also== | ==See also== | ||
<ul><li>The inverse of the <var>AsciiToEbcdic</var> method is <var>[[EbcdicToAscii (String function) | EbcdicToAscii]]</var>.</ul> | <ul><li>The inverse of the <var>AsciiToEbcdic</var> method is <var>[[EbcdicToAscii (String function) | EbcdicToAscii]]</var>.</ul> | ||
{{Template:String:AsciiToEbcdic footer}} | {{Template:String:AsciiToEbcdic footer}} |
Revision as of 05:27, 25 February 2011
Convert ASCII string to EBCDIC (String class)
AsciiToEbcdic is an intrinsic function to convert an ASCII (ISO-8859-1) string to EBCDIC using the current Unicode tables. Optionally, untranslatable characters are represented with character references.
Syntax
%outString = string:AsciiToEbcdic[( [CharacterEncode= boolean])] Throws CharacterTranslationException
Syntax terms
%outString | A string variable to receive the method object string translated to EBCDIC. |
---|---|
string | The input string, which is presumed to consist of ASCII characters. |
CharacterEncode | The optional, but NameRequired, argument CharacterEncode argument is a Boolean enumeration. If its value is:
|
Exceptions
AsciiToEbcdic 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
- More information is available about the Unicode tables.
- The AsciiToEbcdic function is available as of Sirius Mods version 7.3.
Examples
-
The following fragment shows calls of AsciiToEbcdic against strings with and without non-translatable characters.
%a string Len 20 %a = '31':X Print %a:AsciiToEbcdic %a = '318132':X Print %a:AsciiToEbcdic(CharacterEncode=True) Print %a:AsciiToEbcdic
The result is:
1 12 CANCELLING REQUEST: MSIR.0751: Class STRING, function ASCIITOEBCDIC: CHARACTER TRANSLATIONEXCEPTION exception: ASCII character X'81' without valid translation to EBCDIC at byte position 1 ...
See also
- The inverse of the AsciiToEbcdic method is EbcdicToAscii.