Caché ObjectScript Reference
$ZQASCII
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Converts an eight-byte string to a number.
Synopsis
$ZQASCII(string,position)
$ZQA(string,position)
Parameters
string A string. It can be a value, a variable, or an expression. It must be a minimum of eight bytes in length.
position Optional — A starting position in the string, expressed as a positive integer. The default is 1. Position is counted in single bytes, not eight-byte strings. The position cannot be the last byte in the string, or beyond the end of the string. A numeric position value is parsed as an integer by truncating decimal digits, removing leading zeros and plus signs, etc.
Description
The value that $ZQASCII returns depends on the parameters you use.
$ZQASCII can return either a positive or a negative integer.
$ZQASCII issues a <FUNCTION> error if string is of an invalid length, or position is an invalid value.
Example
The following example determines the numeric interpretation of the character string "abcdefgh":
  WRITE $ZQASCII("abcdefgh")
 
It returns 7523094288207667809.
The following examples also return 7523094288207667809:
  WRITE !,$ZQASCII("abcdefgh",1)
  WRITE !,$ZQASCII("abcdefghxx",1)
  WRITE !,$ZQASCII("xxabcdefghxx",3)
 
Notes
$ZQASCII and $ASCII
$ZQASCII is similar to $ASCII except that it operates on eight byte (64-bit) words instead of single 8-bit bytes. For 16-bit words use $ZWASCII; for 32-bit words, use $ZLASCII.
$ZQASCII and $ZQCHAR
The $ZQCHAR function is the logical inverse of $ZQASCII. For example:
   WRITE $ZQASCII("abcdefgh")
 
returns: 7523094288207667809.
   WRITE $ZQCHAR(7523094288207667809)
 
returns “abcdefgh”.
See Also