Previous Next

INT64 function
Takes any data type and returns an INT64 value, if the conversion is possible. This function takes most common data types except for RAW and MEMPTR.
Syntax 
 
INT64 ( expression )
expression
A constant, field name, variable name, or expression whose value can be of any data type except for RAW and MEMPTR. If the value of expression is a CHARACTER, it must be valid for conversion into a number (for example, “1.67" is valid, “1.x3" is not). If expression is an object reference (CLASS), the result is the ABL-generated ID for the class instance. If expression is a LOGICAL, the result is 0 if expression is FALSE and the result is 1 if expression is TRUE. If expression is a DATE, the result is the number of days from 1/1/4713 B.C. to that day. If expression is the Unknown value (?), the result is the Unknown value (?).
Example 
The following example demonstrates how to use the INT64 function to convert a variety of data types to the INT64 data type:
 
DEFINE VARIABLE myint   AS INTEGER   NO-UNDO
  INITIAL 2000000000 FORMAT "->>,>>>,>>>,>>>".
DEFINE VARIABLE myint64 AS INT64     NO-UNDO
  INITIAL 333444555666 FORMAT "->>,>>>,>>>,>>>,>>>".
DEFINE VARIABLE mychar  AS CHARACTER NO-UNDO INITIAL "2234.3".
DEFINE VARIABLE mydec   AS DECIMAL   NO-UNDO INITIAL "240,234.05".
DEFINE VARIABLE mybool  AS LOGICAL   NO-UNDO INITIAL TRUE.
DEFINE VARIABLE mydate  AS DATE      NO-UNDO INITIAL 01/01/06.
DEFINE VARIABLE myhdl   AS HANDLE    NO-UNDO.
 
DEFINE FRAME x WITH TITLE "emptyframe".
myhdl = FRAME x:handle.
 
MESSAGE "integer of integer expression is" INTEGER(myint).
MESSAGE "integer of int64 expression is" INTEGER(myint64 - 333000000000).
MESSAGE "integer of int64 >2gig is" INTEGER(myint64).
MESSAGE "integer of char is" INTEGER(mychar).
MESSAGE "integer of dec is" INTEGER(mydec).
MESSAGE "integer of bool is" INTEGER(mybool).
MESSAGE "integer of date is" INTEGER(mydate).
MESSAGE "integer of handle is" INTEGER(myhdl).
MESSAGE " ".
 
MESSAGE "int64 of integer expression is" INT64(myint).
MESSAGE "int64 of int64 expression is" INT64(myint64 - 333000000000).
MESSAGE "int64 of int64 >2gig is" INT64(myint64).
MESSAGE "int64 of char is" INT64(mychar).
MESSAGE "int64 of dec is" INT64(mydec).
MESSAGE "int64 of bool is" INT64(mybool).
MESSAGE "int64 of date is" INT64(mydate).
MESSAGE "int64 of handle is" INT64(myhdl).
MESSAGE " ".
See also 
GET-INT64 function, PUT-INT64 statement, INTEGER function, DECIMAL function, STRING function

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.