9.1 Built-In Function Rules

Long Names

The majority of existing Built In Functions will accept only the Object Identifier when referring to LANSA Objects. Built In Functions which support long names are documented accordingly.

BIF Argument & Return Value Types

An input argument or return value type can be of type A, N, L, U, w or X.

Type

Description

A

Alphanumeric - allows fields of type Alpha, String and Char.

N

Numeric - allows fields of type Packed, Signed, Float and Integer.

L

List

U

Unicode - allows fields of type Alpha, String, Char, NChar and NVarChar.

w

Any field type except Unicode may be supplied (excluding Lists). This is the same as X, but excluding Unicode.

X

Any field type may be supplied (excluding Lists).

 

All other field types like Date, DateTime and BLOB are classed as their own type and thus are not valid for either an argument/return type 'A', or type 'N'. To use these field types they must be coerced into the correct class using intrinsic functions. Refer to Intrinsic Functions for information about intrinsics.

User defined Built-In Functions require exact field type matches for all RDMLX field types. Therefore, if a String is used in the user defined Built-In Function declaration, then that is all that can be used when it is called. An Alpha field cannot be used. But if an argument is declared as Alpha, then String fields may be used. This anomaly exists due to support for backward compatibility. A user defined Built-In Function cannot declare an argument or return value of type X, U or w.

Fields v. Literals

When the length of an Argument is stated as being greater than 50, this is only true for Fields. Literal values are restricted to a maximum length of 50.

FFC Warning instead of FFC Error for some arguments and return values in RDMLX

If an A, u, w or X (Any) argument or return value has a maximum length of 256, and a longer field is passed, this will be a FFC Warning (the BIF may not cope with fields over 256 bytes in length) instead of an error.

If an N argument or return value has a maximum length of 30 and maximum decimals of 9, and a longer field is passed, this will be a FFC Warning (the BIF may not cope with fields over 30,9) instead of an error.

Unlimited maximum length / maximum decimals in RDMLX

Some BIF arguments and return values will be defined with a new maximum length value of 2147483647, meaning unlimited. This will mean there is no need to check the min/max field length.

Some N or X arguments and return values will be defined with a new maximum decimals value of 32767, meaning unlimited. This will mean there is no need to check the min/max decimals length.

Fields of type Integer

Fields of type Integer have a size in bytes rather than a length, have no decimal places, and are accurate.

The following table provides the implied length for each of the possible byte lengths for an Integer. The implied length is equivalent to the actual length of a signed or packed field.

# Bytes

Max value
(signed)

Max value
(unsigned)

Max # digits
(implied length)

1

127

255

3

2

32767

65535*

5

4

2147483647

4294967295*

10

8

9223372036854775807

18446744073709551615*

19 signed,
20 unsigned*

 

Fields of type Integer may only be used as numeric arguments or return values under the following conditions:

Fields of type Float

Fields of type Float have a size in bytes rather than a length, can be assumed to contain decimal places although not of a fixed length, and are accurate to a certain number of digits.

The following table provides the accurate length for each of the possible byte lengths for a Float. The accurate length may be considered equivalent to the actual length of a signed or packed field. The table also notes the possible number of decimal places at runtime.

# Bytes

Accurate # digits (accurate length)

Possible decimal places

4

6

0 - 6

8

15

0 - 15

 

As the value for a field of type Float may have anywhere between 0 and 15 decimal places at execution time, it is generally not considered suitable as a numeric argument to a BIF as the actual number of decimal places cannot be predicted. An FFC warning will occur if a field of type Float is used for a numeric argument, unless the maximum length of the argument is 2147483647.

However, a field of type Float is suitable as a numeric return value under the following conditions:

Rules for Alphanumeric arguments and return values

Where an alphanumeric argument or return value is required, the following general rules apply in addition to the Built-In Function Argument & Return Value Types just listed.

Rules for Unicode arguments and return values

Argument and return types of X andU support Unicode

The rules for Unicode argument or return values are the same as for Alphanumeric, except :

Rules for List arguments and return values

The FFC does not check the aggregate byte length for working lists. If a specific aggregate byte length is required by the BIF you must ensure it is correct.

All Multilingual Built-In Functions

Non-DBCS SQL Server may corrupt DBCS data. DBCS SQL Server may corrupt all other language's text. To be sure of no corruption, only change text that is compatible with the database server's character set.

Note that the Visual LANSA integrated development  environment performs database IO in a different way and so avoids corruption.