PROGRAM array

CONTAINS

    SUBROUTINE scaler (arg1, arg2)
        IMPLICIT NONE
        REAL, DIMENSION(:, :) :: arg1, arg2
        REAL, DIMENSION(:), ALLOCATABLE :: temp1, temp2
        INTEGER :: m, n

        m = UBOUND(arg1, 1)
        n = UBOUND(arg1, 2)
        IF (m /= UBOUND(arg2, 1) .OR. n /= UBOUND(arg2, 2)) THEN
            PRINT *, 'The arrays are incompatible'
            STOP 1
        END IF
        ALLOCATE(temp1(1:UBOUND(arg1, 1)))
        ALLOCATE(temp2(1:UBOUND(arg1, 2)))
    END SUBROUTINE scaler

END PROGRAM array
