^ARGDIM

Return the dimension number of an argument

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
dim_num = ^ARGDIM(position, dim_index)

Return value

dim_num

The number of the specified dimension. (n)

Arguments

position

The ordinal position of the argument. (n)

dim_index

The index of the dimension to access. (n)

Discussion

If position specifies a nonexistent argument, an “Argument missing” error ($ERR_ARGMIS) is generated.

If position specifies an argument outside of the passed range, an “Incorrect number of subroutine arguments” error ($ERR_WROARG) is generated.

If dim_index specifies an invalid dimension index, an “Invalid number of dimensions” error ($ERR_INVDIM) is generated.

If the specified argument is not dimensioned, the only valid dim_index value is 1, and the return value will also be 1.

Examples

record
    val         ,[3,4,5]a2
    val2        ,a5
proc
    xcall sub(val, , val2)
end
subroutine sub
    arg         ,[*,*,*]a
    arg2        ,a
    arg3        ,a
record
    num,    i4
proc
    num = ^argdim(%argnum(arg), 1)              ;Returns 3
    num = ^argdim(%argnum(arg), 2)              ;Returns 4
    num = ^argdim(%argnum(arg), 3)              ;Returns 5
    num = ^argdim(3, 1)                         ;Returns 1
    num = ^argdim(2, 4)                         ;Error ARGMIS (#2 not passed)
    num = ^argdim(4, 4)                         ;Error WROARG (#4 beyond end)
    num = ^argdim(%argnum(arg), 7)              ;Error INVDIM (No dimension #7)
    xreturn
endsubroutine