Need some help with arrays.



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

Need some help with arrays.

Postby erich » Mon Apr 16, 2018 2:56 am

Hello,

I am struggling to understand the array situation in this program. I've listed the file definition in the picture. Any help would be appreciated.
You do not have the required permissions to view the files attached to this post.
erich
 
Posts: 8
Joined: Mon Apr 16, 2018 2:54 am
Has thanked: 1 time
Been thanked: 0 time

Re: Need some help with arrays.

Postby Robert Sample » Mon Apr 16, 2018 3:15 am

You need an array with 4 occurrences -- 1 for each booking type. For each booking type, you need to have a trip total cost variable, and you need a trip count variable. Initialize the trip total cost and trip count to zero for each array element. Then your processing will be to read a record, add the trip cost to the total cost for that booking type, add 1 to the trip count for that booking type, and repeat until end of file. When you hit end of file, calculate the average trip cost for each booking type and print.

These users thanked the author Robert Sample for the post:
erich (Mon Apr 16, 2018 6:25 am)
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post