I have an array loaded and in a particular field which is defined as
pic 9(7), I want to find the MAX value in it and on which displacement that is located.
I know it can be find out by putting in a loop but I want to use some in built function or some smart technique.
I know ORD-MAX function can be used for this but its giving me kind of weird errors when I am using it as suggested on one of the sites:
01 OrdPos PIC 99.
01 IntArray VALUE "1223037865".
02 Ielement OCCURS 5 TIMES PIC 99.
MOVE FUNCTION ORD-MAX(Ielement(ALL)) TO OrdPos
DISPLAY "Number " Ielement(OrdPos) " is the highest in array".