1

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?

Charles
  • 50,943
  • 13
  • 104
  • 142
cgilley
  • 13
  • 3
  • 2
    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. – cgilley Dec 08 '13 at 23:33
  • 1
    It's like riding bicycle. Once you learned... Glad to see you figured it out. Next time be sure to include actual error messages ok? Enjoy, – Hein Dec 09 '13 at 04:30
  • 2
    Could you put your answer into a separate answer? That way it is easier to see the solution. It is okay to answer you own questions ;-) – Alexander Vogt Dec 09 '13 at 09:09
  • done, sorry about that. – cgilley Jan 07 '14 at 15:37

1 Answers1

0

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

cgilley
  • 13
  • 3