4. Embedded QUEL 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:
Subscript the variable because only scalar-valued elements (integers, floating-point, and character strings) are legal EQUEL values.
The EQUEL preprocessor does not evaluate subscript values when the array is declared and referenced. Consequently, even though the preprocessor confirms that array subscripts have been used, it accepts illegal subscript values. You must make sure that the subscript is legal. For example, the preprocessor accepts both of the following references, even though only the first is correct:
## real salary(5) 
C  declaration

## APPEND TO employee (esal = salary(1)) 
C   Correct reference
## APPEND TO employee (esal = salary(-1)) 
C  Incorrect reference
Do not subscript arrays of variable addresses that are used with param target lists. For example:
## character*200 target 
## integer*4 addr(10) 

C Array of variable addresses

## RETRIEVE (PARAM (target, addr))
For more information about parameterized target lists, see Dynamically Built Param Statements.
The following example uses the variable "i" as a subscript. However, the variable does not need to be declared to EQUEL because array subscripts are not parsed or evaluated.
UNIX:
## character*8  frnams(3) 
   integer        i

   data         frnams /'empfrm', 'dptfrm'. 'hlpfrm'/

   do 10 i = 1, 3 
##    FORMINT frnams(i) 
10    continue 1 

VMS:
##  character*8 formnames(3) / 'empfrm', 'deptform', 
'helpform'/
integer i

do i=1,3
## Forminit formnames(i)
end do  

Windows:
##    declare
##    character*8 formnames(3)/'empfrm','deptform','helpform'/
##    declare forms
       integer i
       character*(*) active
       do i=1,3
       active = formname(i)
##    Forminit active
       end do