(Contents)(Previous)(Next)

General Host Variable Conventions

- The identifier of a host variable may have a maximum length of 32 characters.

- A host variable must not begin with 'sq'.

- A host variable can be a structure or an array.

- A structure may contain arrays.

- Arrays of structures are possible.

- Pointer variables of permitted data types and structures are possible. Pointers to pointers or pointers to arrays are not allowed.

- Host variables of type char [ ] can be declared one byte longer than the corresponding ADABAS columns so that they are long enough to receive the delimiting zero byte. When transferring to ADABAS, the contents of the variable (without the zero byte) are passed and the ADABAS column is padded with blanks, if necessary. When transferring to host variables, trailing blanks are deleted and the delimiting zero byte is placed immediately after the last non-blank character or, if there are no blank characters, right on the last character (in this case, the last character will be overwritten!).

- According to the C notation, a host variable name in uppercase letters is not identical to the same host variable name in lowercase letters.

The scalar C host variables can be contrasted with the corresponding ADABAS data types:

If the data types do not correspond to each other but are of the same category (numeric or character string), then they will be converted. Also numeric values are converted into character strings and vice versa. At precompilation time, the precompiler tests whether the target variable can receive the maximum value of the source variable when values are transferred between database and program. If this is not the case, a warning is issued in the precompiler listing.

ADABAS columns of type 'date' hold date information in the form YYYYMMDD (year, month, day); ADABAS columns of type 'time' hold time information in the form HHHHMMSS (hour, minute, second), ADABAS columns of the type 'timestamp' hold information in the form YYYYMMDDHHMMSSMMMMMM (year, month, day, hour, minute, second, microsecond). The data type 'timestamp' is only valid in sqlmode ADABAS.

Options set during precompilation allow you to vary the representation of 'date', 'time', and 'timestamp'.

The following table indicates the conversion possibilities (x) and the errors and warnings which may occur:

1 An overflow can occur in this case (sqlcode < 0).

1a See 1, if host variable -> ADABAS variable.

1b See 1, if ADABAS variable -> host variable.

2 In such a case, any places after the decimal point, as well as any mantissa places, will be truncated if necessary (indicator value: > 0).

3 In this case, any characters to the right will be truncated, if necessary, whereby sqlwarn1 will be set and the length of the associated ADABAS output column will appear in the indicator (indicator value > 0).

4 Not allowed (sqlcode != 0).

5 An overflow can occur when numeric values are converted into character values (sqlcode < 0).

6 An overflow or an invalid number (sqlcode < 0) can occur when character values are converted into numeric values.

7 The value zero is mapped to 'false', all values not equal to zero are mapped to 'true'.


(Contents)(Previous)(Next)