comp.lang.ada
 help / color / mirror / Atom feed
* Fortran data file -> ADA data file?
@ 2002-07-16 12:41 default
  2002-07-16 13:57 ` Marin David Condic
  2002-07-16 14:56 ` Dan Nagle
  0 siblings, 2 replies; 3+ messages in thread
From: default @ 2002-07-16 12:41 UTC (permalink / raw)



Would ADA be able to process unformatted record files from FORTRAN?  I
am trying to port some FORTRAN code to ADA and this seems like the only
hurdle I may have.  Any input is greatly appreciated.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fortran data file -> ADA data file?
  2002-07-16 12:41 Fortran data file -> ADA data file? default
@ 2002-07-16 13:57 ` Marin David Condic
  2002-07-16 14:56 ` Dan Nagle
  1 sibling, 0 replies; 3+ messages in thread
From: Marin David Condic @ 2002-07-16 13:57 UTC (permalink / raw)


The answer is "It Depends". You're asking a question that is inherently tied
up with the particular OS in question and the particular implementations of
Fortran and Ada on that particular OS. Not all file systems are the same.
Not all implementations of a language will use the same underlying file
system features to implement a specific file type. So if you want to know
the specific answer for your case, you need to post here what OS you're
using, what file type(s) you're interested in accessing, and maybe what
mechanisms were used to write the files originally.

That being said, you can usually rest asured that A Solution Does Exist. Ada
provides standard mechanisms to access sequential, direct, stream and text
files and this usually maps to some OS specific file types. I don't recall
seeing any "standard" mechanisms for accessing ISAM files (if you even care)
but if the OS provides it and you really need it, you can either find a
compiler/vendor that supports it or you can create your own binding to use
it. If the OS has system calls you can make, Ada can find a way to bind to
them, so the job can be done.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com


"default" <default@res.raytheon.com> wrote in message
news:3D34148B.9F3E1F55@res.raytheon.com...
>
> Would ADA be able to process unformatted record files from FORTRAN?  I
> am trying to port some FORTRAN code to ADA and this seems like the only
> hurdle I may have.  Any input is greatly appreciated.
>





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fortran data file -> ADA data file?
  2002-07-16 12:41 Fortran data file -> ADA data file? default
  2002-07-16 13:57 ` Marin David Condic
@ 2002-07-16 14:56 ` Dan Nagle
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Nagle @ 2002-07-16 14:56 UTC (permalink / raw)


Hello,

Question:

Are the Fortran files sequential access or direct access?

The Fortran standard does not specify the means of file storage,
but a common practice has evolved.

If the file is a sequential access unformatted file, then
one likely has for each record:

<4 bytes of record length>user's data<4 bytes of record length>

There may or may not be a physical endfile record.

If the file is a direct access unformatted file, then
one likely has a "pure data" file where the record is located
by using the record length specified on the Fortran open statement
and the record number (i.e., seek ((record number) - 1) * recl).
There may (or may not) be an invisible-to-the-Fortran-programmer
record 0 which contains whatever the Fortran rtl writer
thought was needed.  If so, the formula is seek
((record number) - 1) * recl + (length of record 0)

Of course, the above is all modulo endian issues.

HTH

BTW, Fortran, like Ada, is spelled with the initial only
in upper case.

-- 
Cheers!

Dan Nagle
Purple Sage Computing Solutions, Inc.

On Tue, 16 Jul 2002 08:41:47 -0400, default <default@res.raytheon.com>
wrote:

>
>Would ADA be able to process unformatted record files from FORTRAN?  I
>am trying to port some FORTRAN code to ADA and this seems like the only
>hurdle I may have.  Any input is greatly appreciated.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-07-16 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-16 12:41 Fortran data file -> ADA data file? default
2002-07-16 13:57 ` Marin David Condic
2002-07-16 14:56 ` Dan Nagle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox