$ZLASCII
Synopsis
$ZLASCII(string,position) $ZLA(string,position)
Parameters
Argument | Description |
---|---|
string | A string that can be specified as a value, a variable, or an expression. It must be a minimum of four bytes in length. |
position | Optional — A starting position in the string. The default is 1. |
Description
The value $ZLASCII returns depends on the parameters you use.
-
$ZLASCII(string) returns a numeric interpretation of a four-byte string, starting with the first character position of string.
-
$ZLASCII(string,position) returns a numeric interpretation of a four-byte string beginning at the starting position specified by position.
Upon successful completion, $ZLASCII always returns a positive integer. $ZLASCII returns -1 if string is of an invalid length, or position is an invalid value.
Notes
$ZLASCII and $ASCII
$ZLASCII is similar to $ASCII except that it operates on four byte (32-bit) words instead of single 8-bit bytes. For two byte (16-bit) words use $ZWASCII; for eight byte (64-bit) words, use $ZQASCII.
$ZLASCII(string,position) is the functional equivalent of:
$ASCII(string,position+3)*256 + $ASCII(string,position+2)*256 + $ASCII(string,position+1)*256 + $ASCII(string,position)
$ZLASCII and $ZLCHAR
The $ZLCHAR function is the logical inverse of the $ZLASCII function. For example:
SET x=$ZLASCII("abcd")
WRITE !,x
SET y=$ZLCHAR(x)
WRITE !,y
Given “abcd” $ZLASCII returns 1684234849. Given 1684234849 $ZLCHAR returns “abcd”.