ProvideX V8.20 > Language Reference > 3. System Functions
546
UPK( ) Function
          Unpack Numeric Data
Format
UPK(string$[,ERR=stmtref])
Where:
stmtref
Program line number or label to transfer control to.
string$
String expression whose value represents a packed number.
Returns
Numeric expression of whose value has been packed into a string.
Description
UPK( ) is used to convert a packed string into its numeric value. It is the counterpart
of the PCK( ) function.
The packing algorithm used takes a numeric value and splits it into a series of two
digit values where each of the two digit values represents a number between 0 and
99. These numbers are then added to 32 to create the series of single-byte printable
characters that comprise the packed string. To unpack the value each byte of the
string has 32 subtracted from it and the resultant values become a series of 2-digit
values in the final result.
Should the value of any two-digit pair (when added to 32) equal or exceed the
standard file separator ($8A$), the value will be incremented by one when the
output string is created. When unpacking the string, any byte exceeding the field
separator will be reduced by one prior to subtracting 32.
Note: This function is not necessarily compatible with all Business Basics
See Also
PCK( ) Pack Numeric Data, p.496
CMP( ) Compress Data, p.402