21. 4GL Statement Glossary : Callproc : 3GL Arguments
 
Share this page                  
3GL Arguments
The following table summarizes how to declare, within your 3GL procedure, parameters to pass from your 4GL application to your 3GL procedure:
4GL Data Type
3GL Variable Declaration
varchar, text
A variable‑length character string. Unlike the fixed‑length character types char and c, these variable‑length character fields are not extended with blank characters before being passed to 3GL; only the amount of data entered into the field is passed to 3GL. Your 4GL program can determine the declared size of a field and the current amount of data in the field by calling the size and length string functions.
char, c
A fixed‑length character string. The fixed size is determined by the length of the field on the form as declared using the ABF FormEdit operation, or, for a global variable, by its declared size in 4GL. Data entered into the field is padded with blank characters up to its full declared length before being passed to 3GL.
date
Fixed‑length, 25‑byte character string.
money
Extended precision (8‑byte) floating point.
integer, I
Integer.
decimal
A fixed‑point exact number. Depending on the 3GL, a decimal value is declared as either a packed decimal or a float.
float, f
Floating point.
All data types can also be passed to 3GL with the byref option. When working in 3GL with character data passed to it by reference, be careful not to extend a character variable beyond its 4GL declared length.
You cannot pass a char or varchar variable that contains an embedded zero byte (hexadecimal '00') to 3GL. A truncated version of the 4GL variable can be passed.
When a 4GL date variable passes to a 3GL routine by reference, or when the return type of a 3GL procedure is date, then 4GL receives it back from the 3GL routine as a 25‑byte string. You must then convert it to Ingres internal date format. The date must be valid before the conversion can succeed.
3GL procedures do not support Null values passed from 4GL. Passing a 4GL nullable-type variable containing a Null value causes a runtime error. Use the IFNULL function and IS NULL comparison operator to pass nullable types between 3GL and 4GL. For example:
IFNULL (v1, v2)
This reference returns the value of v1 if v1 is NOT NULL; otherwise, if v1 is NULL, it returns the value of v2. The variables v1 and v2 must be of the same data type. (See your query language reference guide for more information on IFNULL.)
If an impossible value exists for the argument, use the impossible value to indicate a NULL:
callproc empcalc (IFNULL (age, -1));