View previous topic :: View next topic
|
Author |
Message |
bharat_juneja
New User
Joined: 21 Dec 2005 Posts: 20 Location: US
|
|
|
|
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".
<<<<
Thanks,
Bharat |
|
Back to top |
|
|
ksivalakshmi
New User
Joined: 15 Nov 2005 Posts: 2 Location: Hyderabad
|
|
|
|
Hi Bharat,
Compute should be used instead of Move.
COMPUTE OrdPos = FUNCTION ORD-MAX(Ielement(ALL)) |
|
Back to top |
|
|
bharat_juneja
New User
Joined: 21 Dec 2005 Posts: 20 Location: US
|
|
|
|
Thanks, that works. |
|
Back to top |
|
|
|