4. Embedded SQL for Fortran : Fortran Variables and Data Types : Variable Usage : Array Variables
 
Share this page                  
Array Variables
The following syntax refers to an array variable:
:arrayname (subscripts)
Syntax Notes:
You must subscript the variable because only scalar-valued elements (integers, reals and character strings) are legal SQL values.
When you declare the array, the Embedded SQL preprocessor does not parse the array bounds specification. Consequently, the preprocessor accepts illegal bounds values. Also, when you reference an array, the preprocessor does not parse the subscript. The preprocessor confirms only that an array subscript is used with an array variable. You must ensure that the subscript is legal and that the correct number of indices is used.
The preprocessor does not accept substring references for character variables.
Arrays of indicator variables used with structure assignments must not include subscripts when referenced.
The following example uses the "i" variable as a subscript. It does not need to be declared in the declaration section because it is not parsed.
Example: Variable as subscript usage
      exec sql begin declare section
                character*8 frmnam(3)
      exec sql end declare section
      integer i
                  frmnam(1) = "empfrm"
                  frmnam(2) = "dptfrm"
                  frmnam(3) = "hlpfrm"
      do 100 i=1,3
100      exec frs forminit:formname