A vector subscript is an integer array expression of rank one, designating a sequence of subscripts that correspond to the values of the elements of the expression.
A vector subscript can be a real array expression of rank one in XL Fortran.
INTEGER A(10), B(3), C(3)
PRINT *, A( (/ 10,9,8 /) ) ! Last 3 elements in reverse order
B = A( (/ 1,2,2 /) ) ! B(1) = A(1), B(2) = A(2), B(3) = A(2) also
END
If a vector subscript has more than one element with the
same value, an array section with that vector subscript cannot appear
in any of the situations mentioned in Syntactic contexts of definition or undefinition of variables.! We can use the whole array VECTOR as a vector subscript for A and B
INTEGER, DIMENSION(3) :: VECTOR= (/ 1,3,2 /), A, B
INTEGER, DIMENSION(4) :: C = (/ 1,2,4,8 /)
A(VECTOR) = B ! A(1) = B(1), A(3) = B(2), A(2) = B(3)
A = B( (/ 3,2,1 /) ) ! A(1) = B(3), A(2) = B(2), A(3) = B(1)
PRINT *, C(VECTOR(1:2)) ! Prints C(1), C(3)
END