Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion record length in an unformatted (binary) file
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Richard Maine  
View profile  
 More options Oct 1 2012, 10:23 pm
Newsgroups: comp.lang.fortran
From: nos...@see.signature (Richard Maine)
Date: Mon, 1 Oct 2012 19:23:00 -0700
Subject: Re: record length in an unformatted (binary) file

marcio.pmz <mtnobrega....@gmail.com> wrote:
> Is there somehow to know the lenght of records in an unformatted (binary)

file?

Not anything portable or defined by the standard.

I might also note that "binary" is not a term defined by the Fortran
standard, and it is not well-defined what it means. The literal meaning
("base 2") is almost never what anyone means when talking about computer
files. Although different people use the term with different meanings
(which is why I avoid it), perhaps the most common meaning is to
describe an unformatted file that has no record structure. That takes a
pretty long stretch to connect to the word "binary", but still that's
the most common usage. If that happens to be what you mean, then such a
file doesn't *HAVE* an inherent record length to be known.

With most implementations, you can open such a file with any record
length as long as you are using direct access. "Records" are arbitrarily
defined to be chunks of data of whatever size you specify in the open,
but these records have no physical embodiment in the file. You usually
can't open such a file for sequential acess at all. Exceptions exist,
but that's the way most implementations work.

I might note that unformatted stream access, introduced in f2003, and
supported by most current compilers, is a more natural fit to such
"binary" files.

> Would 'inquire' statement be an option?

No.

> Of course I understand that with the record length I may use direct access
> at open statement. On the other hand, if I wish to use sequential
> access, how would I use the record length info?

For sequential access, the recl specifier in the open statement is not
actually the record length. It is the maximum record length. There is
usually little reason to specify it for sequential access. In the past,
some implementations have had fairly small default values for the
maximum record length. In that case, specifying a large value for recl
might tell the implementation to accomodate suffcient buffers or other
resources required to support that record length. However, to me
knowledge, most current implementations default to having the recl limit
as large as the implementation can support, which is often something
like 2GB (or sometimes more). If you are working with records long
enough that this is an issue, there are probably lots of other matters
that also need careful attention.

--
Richard Maine                    | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle           |  -- Mark Twain


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.