Jive Types & Variables
Jive supports a full range of data types:
Each data type can have a missing value called null in SQL.
- string - variable length text
- int - 32 bit integer
- float - 64 bit floating point
- bool - 1 bit logical value (true, false)
- date - year, month, day
- time - hour, minute, second
- timestamp - year, month, day, hour, minute, second, nanosecond
Literal values for each data type:
Most reasonable conversions are supported. All data types can be
converted to and from string and to bool. Converting from strings
uses the same format as the literal representation above. A quoted string
literal can be used for timestamp. For example:
- string - text surrounded by single or double quotes
- int - optional sign and 1 or more numeric digits
- float - optional sign and numeric digits with decimal point (a leading
decimal point is discouraged)
- bool - true or false - preset variables
- date - country format (mm/dd/yyyy, mm/dd/yyyy or yyyy/mm/dd)
where y, m, d are numeric
- time - hh:mm:ss where h, m, s are numeric
- timestamp - no literal representation
var timestamp test_value = '12/31/1996 23:59:59.999999999'
Additionally, a quoted string literal for float can contain exponental
(e) notation. For example:
var float million = '1e+6'
Like C/C++, adjacent quoted strings are quietly combined. The same
type of quotes (single or double) must be used to combine strings.
The var Command is used to create variables.
A variable has a data type and a value. The value of a variable is
assigned with the set Command. A variable
is local to its containing block - a query (select) block,
a while block, a proc body
or the entire Jive text (effectively, global).
Variables in the outer enclosing block can be referenced unless their
name is overridden by a more inner variable definition.
This is also true for calls. Jive subroutines can reference variables
in the context of the call. It is recommended that this only be used
for global variables.
Qualification can be used to reference global variables (using root
as the qualifier) and query result variables.
Queries may be labelled or use the default label - query, as a
Dot (.) is used to delimit qualifiers.
Multiple qualifiers descend from the left. Inner qualifiers
can be omitted like COBOL.
A variable must contain a value of its defined type, or it must be
null. Nulls in Jive are the same as in SQL. Nulls
can be passed between Jive and SQL databases. null is a keyword
in Jive for a null. For example,
set a = null
A null is also used for uninitialized variables and as the
result of syntax or semantic errors. For example,
set x = y
will set x to null when y is undefined.
Variables can also be created with:
Result column variables are readonly.
[Return to Main Page]
Jive(tm) 2, Copyright © 1997 FFE Software All Rights Reserved WorldWide