How to: |
Available Languages: reporting, Maintain
The BYTVAL function translates a character to the ASCII, EBCDIC, or Unicode decimal value that represents it, depending on the operating system.
BYTVAL(character, output)
where:
Alphanumeric
Is the character to be translated. You can specify a field or variable that contains the character, or the character itself enclosed in single quotation marks. If you supply more than one character, the function evaluates the first.
Integer
Is the name of the field that contains the corresponding decimal value, or the format of the output value enclosed in single quotation marks.
BYTVAL translates the first character of LAST_NAME into its ASCII or EBCDIC decimal value and stores the result in LAST_INIT_CODE. Since the input string has more than one character, BYTVAL evaluates the first one.
TABLE FILE EMPLOYEE PRINT LAST_NAME AND COMPUTE LAST_INIT_CODE/I3 = BYTVAL(LAST_NAME, 'I3'); WHERE DEPARTMENT EQ 'MIS'; END
The output on an ASCII platform is:
LAST_NAME LAST_INIT_CODE --------- -------------- SMITH 83 JONES 74 MCCOY 77 BLACKWOOD 66 GREENSPAN 71 CROSS 67
The output on an EBCDIC platform is:
LAST_NAME LAST_INIT_CODE --------- -------------- SMITH 226 JONES 209 MCCOY 212 BLACKWOOD 194 GREENSPAN 199 CROSS 195
This Dialogue Manager request prompts for a character, then returns the corresponding number. The following reflects the results on the Windows platform.
-SET &CODE = BYTVAL(&CHAR, 'I3'); -HTMLFORM BEGIN <HTML> <BODY> THE EQUIVALENT VALUE IS &CODE </BODY> </HTML> -HTMLFORM END
Assume the value entered for &CHAR is an exclamation point (!). The output is:
THE EQUIVALENT VALUE IS 33