VAX Fortran Keyed indexed file - sequential access

388 views Asked by At

Okay, I know I'm going back a few years, but maybe I'll run across some graybeards (like mine) :).

I have an indexed data file with a key field. It's opened like so in the application:

OPEN (FILE='DATA.MAS',STATUS='OLD',
1     ORGANIZATION='INDEXED',ACCESS='KEYED',
1     RECL=28,UNIT=LUNTM,SHARED,
1     KEY=(1:49:CHARACTER),
1     IOSTAT=IOS,ERR=9999)

I need to be able to scan the content of this file sequentially. However, every combination of organization and access options in the open, followed by reads always results in an error, either on the open or the read. Is it even possible to get the nth record of a keyed file?

1

There are 1 answers

0
cgilley On

Okay, found the solution after reading the doc for the umpteenth time. I changed the OPEN statement for SEQUENTIAL access and INDEXED organization. What I missed was that when you do this, FORTRAN interprets the file as FORMATTED. Adding FORM='UNFOFRMATTED' and adjusting the record size yields happiness and yuletide greetings