SHAPE(SOURCE)

Purpose

Returns the shape of an array or scalar.

Class

Inquiry function

Argument Type and Attributes

SOURCE
is an array or scalar of any data type. It must not be a disassociated pointer, allocatable object that is not allocated, or assumed-size array.

Result Value

The result is a one-dimensional default integer array whose elements define the shape of SOURCES. The extent of each dimension in SOURCES is returned in the corresponding element in the result array.

Related Information

RESHAPE(SOURCE, SHAPE, PAD, ORDER).

Examples

! A is the array  | 7 6 3 1 |
!                 | 2 4 0 9 |
!                 | 5 7 6 8 |
!
       RES = SHAPE( A )
! The result is | 3  4 | because A is a rank-2 array
! with 3 elements in each column and 4 elements in
! each row.
IBM Copyright 2003