Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Find the MAX value of an element in an array

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
bharat_juneja

New User


Joined: 21 Dec 2005
Posts: 20
Location: US

PostPosted: Wed Jul 12, 2006 2:55 am    Post subject: Find the MAX value of an element in an array
Reply with quote

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
View user's profile Send private message

ksivalakshmi

New User


Joined: 15 Nov 2005
Posts: 2
Location: Hyderabad

PostPosted: Wed Jul 12, 2006 12:26 pm    Post subject:
Reply with quote

Hi Bharat,

Compute should be used instead of Move.

COMPUTE OrdPos = FUNCTION ORD-MAX(Ielement(ALL))
Back to top
View user's profile Send private message
bharat_juneja

New User


Joined: 21 Dec 2005
Posts: 20
Location: US

PostPosted: Wed Jul 12, 2006 9:05 pm    Post subject: Re: Find the MAX value of an element in an array
Reply with quote

Thanks, that works.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Find a string in PS file opened in br... mukkas CLIST & REXX 2 Sat Feb 24, 2018 2:15 pm
No new posts XML Generate with Attribute & Ele... Log Thangavel COBOL Programming 5 Fri Jan 19, 2018 6:21 pm
No new posts Command to find TMEMBER name for a TPIPE Siva NKK Kothamasu IMS DB/DC 0 Wed Aug 16, 2017 6:08 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us