DEFINE
The DEFINE statement declares the names and data types of 4GL variables.
is a name that you declare here as the identifier of a variable.
A variable is a named location in memory that can store a single value, or an
ordered set of values. Except for predefined global variables like status,
int_flag, quit_flag, or the SQLCA record, you cannot reference a variable before it
has been declared by the DEFINE statement.
Declaring the Names and Data Types of Variables
The DEFINE statement must declare the name and the data type of each new
variable, either explicitly or else implicitly (by using the LIKE keyword):
column is the name of a database column, qualified by the name or synonym of a table
or view.
table is the name or synonym of a database table or view
is the name of the variable. This must be unique among variables within the
same scope of reference
Variables of Simple Data Types
maximum size is a whole number from 1 to 255, specifying the largest number of characters
that the VARCHAR data type can store.
precision specifies the total number of decimal digits, from 1 to 32.
reserve size is a whole number, from 0 to maximum size. The default is 0.
(Like precision for FLOAT or DOUBLE PRECISION, 4GL accepts this value for
compatibility with SQL, but does not use this value.)
scale is a whole number, from 1 to precision, specifying the number of digits in the
fractional part of a fixed-point number.
size is a whole number from 1 to 32,767, specifying how many characters a CHAR data
type can store. The default is 1.
Indirect Typing
You can use LIKE after the names of variables to declare variables that have
the same simple data types as specified columns in a database table.)
column is the identifier of some column in table, as it appears in the syscolumns
table of the system catalog.
database is the identifier of the database in which the table resides.
owner is the login name of the owner of the table containing the column.
server is the identifier of an OnLine server. The @ symbol is required.
table is the identifier or synonym of a table or view in the specified database or
else a default database from the DATABASE statement.
is the 4GL identifier of a variable that you declare here.
If table is a view, then column cannot be based on an aggregate. If LIKE
references a SERIAL column, the new variable is of the INTEGER data type.
Variables of Large Data Types
These store pointers to binary large object (BLOB) values, up to 2**31 bytes in size (or up to a limit imposed by your implementation of INFORMIX-OnLine):
TEXT Character strings.
BYTE Anything that can be digitized and stored on your system.
Variables of Structured Data Types
INFORMIX-4GL supports two structured data types for storing sets of values:
ARRAY Arrays of values of any data type except ARRAY.
RECORD Sets of values of any data type, or any combination of types.
ARRAY Variables
The ARRAY keyword declares a structured variable that can store a 1-, 2-, or
3-dimensional array of values, all of the same data type:
size is the number (up to 32,767) of elements in a dimension. Dimensions can be
different sizes, up to the limit of your C compiler.
The elements of an ARRAY variable can be of any data type except ARRAY. The
limit on the total number of elements in an array is compiler-dependent.
RECORD Variables
A 4GL program record is a collection of members, each of which is a variable.
The member variables of a record can be of any 4GL data type, including the
simple data types, the structured (ARRAY, RECORD) data types, and the large (
BYTE, and TEXT) data types.:
member is a name that you declare for a member variable of the record; this
identifier must be unique within the record.
table is the name or synonym of a table or view in a database from the table
qualifier, or in a default database that DATABASE specified before the first program
block in this module. You cannot specify table.* here, if table is a view
containing an aggregate column.
References
DATABASE
FUNCTION
GLOBALS
MAIN
REPORT