The following list describes the variable declaration syntax that the SQL precompiler supports in Pascal: o Data type keywords Declarations can include only the following Pascal data types: - INTEGER8, INTEGER16, INTEGER32, and INTEGER64 - REAL - SINGLE - DOUBLE - F_FLOAT - D_FLOAT - G_FLOAT - S_FLOAT - T_FLOAT - CHAR - PACKED ARRAY [1..n] OF CHAR; - VARYING [u] OF CHAR - [BYTE] -128..127; - [WORD] -32768..32767; - Date-time data types (Precompiler Date-Time Data Mapping lists these data types.) In addition, the SQL Pascal precompiler provides the following data types: - SQL_LONG_VARCHAR - SQL_DATE - SQL_SMALLINT - SQL_INDICATOR - SQL_BIGINT - SQL_QUAD - SQL_DATE, SQL_DATE_ANSI, SQL_DATE_VMS - SQL_TIME, SQL_TIMESTAMP - SQL_INTERVAL (DAY TO SECOND) Use this data type for variables that represent the difference between two dates or times. (Precompiler Date- Time Data Mapping lists all the supported INTERVAL data types.) o Records The SQL precompiler supports Pascal record definitions. It also supports nested records such as the following: type_record_type = record employee_id : employee_id_str; last_name : last_name_str; first_name : first_name_str; middle_init : middle_init_str; address_dat1: address_str; address_dat2: address_str; city : city_str; state : state_str; postal_code : postal_code_str; sex : sex_str; status_code : status_code_str; end; name_rec = record last_name : last_name_str; first_name : first_name_str; middle_init : middle_init_str; end; address_rec = record address_dat1 : address_str; address_dat2 : address_str; city : city_str; state : state_str; postal_code : postal_code_str; end; rec_in_rec = record employee_id : employee_id_str; emp_name : name_rec; emp_addr : address_rec; sex : sex_str; status_code : status_code_str; end; rec_in_rec_in_rec = record nested_again : rec_in_rec; end; A record that is used in an SQL statement cannot contain a pointer to another record. The SQL precompiler does not support variant records. o Initial value assignments The SQL precompiler supports initial values assigned in the declaration: dateind : SQL_INDICATOR:=0; o Arrays Packed arrays are supported to declare SQL character strings. Single-dimension arrays are supported to declare an indicator array to refer to a structure in SQL statements. The elements of the array must be declared as word integers [WORD]- 32768..32767 or SQL_INDICATOR. o Pointers The SQL precompiler for Pascal supports one level of pointers. type a = ^integer; var b : a; (* the use of the variable b is supported *) c : ^a; (* do not use any form of variable c in an SQL statement) NOTE The Pascal precompiler for SQL gives an incorrect %SQL-I- UNMATEND error when it parses a declaration of an array of records. It does not associate the END with the record definition, and the resulting confusion in host variable scoping causes a fatal error. To avoid the problem, declare the record as a type and then define your array of that type. For example: main.spa: program main (input,output); type exec sql include 'bad_def.pin'; !gives error exec sql include 'good_def.pin'; !ok var a : char; begin end. --------------------------------------------------------------- bad_def.pin x_record = record y : char; variable_a: array [1..50] of record a_fld1 : char; b_fld2 : record; t : record v : integer; end; end; end; end; --------------------------------------------------------------- good_def.pin good_rec = record a_fld1 : char; b_fld2 : record t : record v: integer; end; end; end; x_record = record y : char variable_a : array [1..50] of good_rec; end;