Retrive max,min & avg values from file



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Retrive max,min & avg values from file

Postby 9949125444 » Mon Feb 07, 2011 12:03 am

HOW WE CAN GET THE MAXIMUM SALARY AND MINIMUM SALARY AND AVERAGE SALARY BY USING SEQUENTIAL FILE IT CONTAINS SALARY DETAILS....?
PLEASE ANY BODY CAN HELP ME OVER IT!!!
9949125444
 
Posts: 2
Joined: Fri Jan 21, 2011 10:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Retrive max,min & avg values from file

Postby dick scherrer » Mon Feb 07, 2011 12:23 am

Hello and welcome to the forum,

TURN OFF THE CAPS. . . That is just rude. . .

From the little you've posted, suggest you read the file and store the maximum and minimum salary values as they are discovered. While discovering the min and max, sum all of the salary values read and count the records read. When end of file is reached show the min and max, divide the total salary by the number of records to get the average and show that value.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Retrive max,min & avg values from file

Postby 9949125444 » Mon Feb 07, 2011 10:33 am

Thanks for the reply and sorry mistake will not repeat again
9949125444
 
Posts: 2
Joined: Fri Jan 21, 2011 10:24 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post