Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrays

Status
Not open for further replies.

mic2740

Technical User
Mar 6, 2001
5
US
I'm in a chapter that is dealing with arrays. In my problem, I have to read a table with an array of 90. After reading the table, I then read the data file. My first question is this: I've never had to deal with the reading in of more than one item, so I'm not sure how I start with this. Then, I understand how you call each individual part of an array, but I am lost when it comes to how I initialize it and set it up. Is this something I take care of in the FD or in working storage? My textbook has an example, but I'm lost. Can anyone help me understand this?
Thanks!
Michelle
 
You will need at least two FD's, one for the table data and one for the input data. Both files should be opened for input in the PROCEDURE DIVISION and the first record of each file should be read as part of the initialization.

Next, you should process the table using a PERFORM VARYING to load each entry in your table, stopping when you either run out of entries in your table or records in your table file.

Now that the table has been loaded, you can use the standard logic that you are familiar with to read and process your input records.

I could be more specific, but I don't want to give away the whole program. If you have specific questions once you get started, I'll be happy to answer them for you.
Betty Scherber
Brainbench MVP for COBOL II
 
Thanks for replying to my post Betty. I have finished the main part of this program, but I've got a compiling error that I'm not sure how to deal with. This error message says "Educational Version Restriction". This comes right at the end of my FD. I have the code written at this portion like this:
FD registration-table.
01 table-record.
05 tbl-vehicles occurs 90 times
ascending key is tbl-class indexed by x1.
10 tbl-class pic xx.
10 tbl-rate pic 9v99.
This error message is shown at the very last period there.
Thanks
Michelle
 
Is your entire table really just one record in a file? Normally I would expect the table data records to each contain one class and one rate and the table itself would reside in the WORKING-STORAGE SECTION.

It appears that your error message applies to using a free educational version of a compiler. These versions are frequently not very robust. It may be that the changes I suggested will work if the table is in another area. Betty Scherber
Brainbench MVP for COBOL II
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top