Clbfile

This keyword declares a character large object (CLOB) variable.

Syntax

Local    Clbfile NAME(LENGTH)
Local    Clbfile NAME(LENGTH)(DIMENSIONS)
Variable Clbfile NAME(LENGTH)(DIMENSIONS)
Value    Clbfile NAME(LENGTH)(DIMENSIONS)
Const    Clbfile NAME(LENGTH)(DIMENSIONS)
  • NAME is the name of the variable declared.
  • LENGTH is an integer value between 0 and 20.
  • DIMENSIONS can be:
    • A single numeric value DIM, which means that we have an array with an index range from 0 to DIM-1.
    • A range of numeric values INDEX1..INDEX2. The index varies between INDEX1 and INDEX2.
    • Several indexes or index ranges separated by a comma. For multiple dimension arrays, up to four dimensions are possible.

Several variable declarations can be done on the same line, separated by a comma.

Local declarations create the variables in the current local variable class that is not seen by nested or calling sub-programs. The Call / Subprog and func / Funprog insulate the local variables as well as the calls of method by fmet.

Const, Variable, and Value declarations state the arguments sent by a Call, func, or fmet. With these syntaxes, the dimensions and the index ranges can be omitted wherever the parentheses are present. The dimension and index ranges are defined by the calling program.

Example

# Direct declarations
Local Clbfile MYTEXT(2), MYCOMMENTS(2), REFERENCES(3) : # Local large character variables
Local Clbfile MYTEXT_ARRAY(2)(1..10) : # An array of 10 large texts
# A sub-program sending a text and returning a result
Funprog SEND_TEXT(TEXT)
Variable Clbfile TEXT()(,) : # A 2 dimensions matrix of pictures is sent as references
...
End SEND_STATUS
# A sub-program storing texts
Subprog STORE_TEXTS(TEXT)
Value Clbfile TEXT()(1..3) : # An array of 3 elements is sent (a copy is done when passing the arguments)
...
End

Comments

The dimension is used to size per default the variable, but if a value exceeding this size is assigned, the execution engine will automatically resize the variable.

The correspondence between the dimension and the default memory size allocated is given by the following table:

Dimension Memory size Maximum number of characters stored
0 1020 510
1 2044 1022
2 4092 2046
3 8188 4094
N 1024*2^N-4 512*2^N-2

There is still a Global declaration variable that exists for variables that have to be seen in the scope of a process execution, but its use is strongly discouraged.

Implicit data type conversion

The Clbfile data type will implicitly convert Date and Clbfile to a Char

Local Clbfile MY_CLOB(1)                  # Declare Clob
Local Char MY_CHAR(30)                    #
Local Date MY_DATE
MY_DATE=[31/12/2099]
MY_CHAR="AAAA"
MY_CLOB = MY_CHAR-MY_DATE                  # MY_CLOB = "AAAA 20991231"

Note that Append will not implicitly convert a date to a string.

See also

Global, Local, Variable, Value, Const, Tinyint, Shortint, Date, Integer, Float, Double, Decimal, Char, Blbfile, Uuident, Datetime, Instance.