Relatively inexperienced in writing/diagnosing binary and I've got a problem that is driving me nuts. I'm trying to open and write to a binary file using the following code:
OPEN(123, &
FILE= 'filename', &
FORM='UNFORMATTED', &
ACCESS='DIRECT', &
RECL=32)
**this write statement is contained within a loop
WRITE(123, REC=count) time(count),stn(count),launch(count)
Setting RECL to either 1 or 4 gives an error;
"attempt to read/write past end of record"
So I assume for my compiler (pgf90) that record length refers to the entire file, but not sure.
If I set the record length to an arbitrarily higher number (eg. 128) then the code compiles and executes without errors but the resulting binary file doesn't contain any of the data that should have been written.
Any help/suggestions, appalled gasps at programming style would be appreciated.
Thanks
OPEN(123, &
FILE= 'filename', &
FORM='UNFORMATTED', &
ACCESS='DIRECT', &
RECL=32)
**this write statement is contained within a loop
WRITE(123, REC=count) time(count),stn(count),launch(count)
Setting RECL to either 1 or 4 gives an error;
"attempt to read/write past end of record"
So I assume for my compiler (pgf90) that record length refers to the entire file, but not sure.
If I set the record length to an arbitrarily higher number (eg. 128) then the code compiles and executes without errors but the resulting binary file doesn't contain any of the data that should have been written.
Any help/suggestions, appalled gasps at programming style would be appreciated.
Thanks