<email@example.com> wrote in message
> For Fortran 95, is there a way to randomly access an unformatted
> sequential file?
Not in standard Fortran 95. Variable length records can only be accessed
sequentially. In order to do random access, you need fixed-length records.
However, these restrictions are for standard F95. For another option, see
> My original file is written as unformatted and the records are of
> varialbe length which I can find out easily. The files are very big,
> generally 50 gigabytes each. Now I need to search of specific
> information in the file. Though I know the exact position in the file,
> I don't know to access that position. What kind of options do I have?
> Thank you.
> William Hu
> University of Memphis
Fortran 2003 introduces the idea of stream I/O. You can do this using
ACCESS="STREAM" on the OPEN statement. Among other properties, stream I/O
allows access by character position (for formatted files) or by file storage
unit (for unformatted files). The standard recommends, but does not require,
that file storage units be 8-bit octets in situations where this is practical.
Stream I/O is proving to be a popular Fortran 2003 feature, so many Fortran
95 compilers are implementing it early in their development schedules. Several
Fortran compielrs already have implemented it in their current commercial
If your files are around 50.0 GB, then you will need 8 byte integers in
order to position your file by file storage unit. The Fortran 2003 standard
allows the use of any kind of integer in specifying positioning by file storage
Ther are other options, but they are non-standard and may be available only
on a very limited set of platforms. If you want advice on these other options,
you will need to let us know what compilers and operating systems you are using.
17130 W. Burleigh Place
P. O. Box 423
Brookfield, WI 53008-0423
Voice: (262) 783-5869
Fax: (262) 783-5928
Mobile: (414) 412-5869
E-mail: <firstname.lastname@example.org> or <email@example.com>