Using DEC Fortran to read raw binary data? 
Author Message
 Using DEC Fortran to read raw binary data?


|>I use the following under DEC fortran to read binary files:
|>
|>      OPEN(2,FILE='XXX',STATUS='OLD',
|>     &    FORM='UNFORMATTED',RECORDTYPE='STREAM')
|>      READ(2) I,J,K
|>      READ(2) X,Y,Z

This would not work on OpenVMS - it would work on Digital UNIX or ULTRIX.
--


DEC Fortran Development           WWW:   http://www.*-*-*.com/
Digital Equipment Corporation     CompuServe: 75263,3001
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698             "Free advice is worth every cent"

For information on DEC Fortran 90, see http://www.*-*-*.com/



Mon, 29 Jun 1998 03:00:00 GMT  
 Using DEC Fortran to read raw binary data?

Quote:
>DEC is not alone in this sort of problem.  That is why I have vainly
>advocated the idea that Fortran needs to have a totally standardized
>byte-stream data format, which can read or write ANY external data
>format of all common media and TCP/IP network transmissions.  C/C++
>mostly do have that capability, even though it isn't technically in the
>standard (e.g., CHAR isn't always 8 bits, and raw data formats aren't
>actually required), and you do have to work a bit at it.  Ideally
>Fortran should go a step further and add conversion functions to convert
>to and from all common integral and floating point formats now in use.

>As I have said before, I believe that in today's multi-platform
>environment, where you probably will throw away each machine in a
>few years, much of the data is created by C/C++ programmers, and a
>randomly chosen computer manufacturer will probably go bankrupt
>anyway, something approaching true portability and true
>ability to read and write ANYTHING are desperately needed.  

>Standardized Fortran bit packing and (good) data compression would also
>help in those areas (like remote sensing) where data volumes are huge.
>(Those formats, like HDF, HTML, CEOS, et al, that are standardized,
>are often too inefficient, in bits and time, to be practical.)

I support these ideas.

Quote:
>Is this such a big thing to ask?  If I thought it had the slightest
>ghost of a chance, I would be happy to write up a simple spec to
>begin with (I don't know enought about various media to take it
>all the way), on my own time.  But I know it would be drowned by the
>people working on 6 or 38 bit machines, by people working on operating
>systems with serious inherent limiations, or by people who hate
>standards...  Maybe true standards and full capabilities would make
>Fortran more competitive.

Let's do it the other way around. Write your specs. A few volunteers
(I'd be one of them) can then provide implementations for DEC, Sun, IBM,
SGI, Cray, ... It would not be difficult to get it accepted by
the user community (at least, most of those that I know in Europe would
jump in). Then we can come to WG5 with this technical report and de facto
industry standard. I doubt that their objections would still hold.

Michel

--

| IFREMER: Institut Francais de Recherches pour l'Exploitation de la Mer|
| Centre de Brest - B.P. 70                     phone : +33  98 22 41 44|
| F-29280 PLOUZANE - FRANCE                     fax   : +33  98 22 41 35|
| http://www.ifremer.fr/ditigo/molagnon/molagnon.html                   |



Tue, 30 Jun 1998 03:00:00 GMT  
 Using DEC Fortran to read raw binary data?
One more vote for praise.  Steve was kind enough to point out a
bug in the DEC Fortran compiler for me -- and a source for the
fix -- that saved me loads of time.


Tue, 30 Jun 1998 03:00:00 GMT  
 Using DEC Fortran to read raw binary data?
|> Let's do it the other way around. Write your specs. A few volunteers
|> (I'd be one of them) can then provide implementations for DEC, Sun, IBM,
|> SGI, Cray, ... It would not be difficult to get it accepted by
|> the user community (at least, most of those that I know in Europe would
|> jump in). Then we can come to WG5 with this technical report and de facto
|> industry standard. I doubt that their objections would still hold.

Maybe a module encapsulating XDR would be enough.
Something like :

module XDR
  use f90_kind

  type xdr_stream
    private
    ...
  end type

  interface xdr_read
     subroutine read_scal_byte(stream, i)
        type(xdr_stream) stream
        integer(INT8) i
     end subroutine
     subroutine read_scal_int(stream, i)
        ...
     subroutine read_scal_float(stream, x)
        ...
     subroutine read_scal_double(stream, x)
        ...
     subroutine read_array_byte(stream, i)
        type(xdr_stream) stream
        integer(INT8) i(:)
     end subroutine
     subroutine read_array_int(stream, i)
        ...
     subroutine read_array_float(stream, x)
        ...
     subroutine read_array_double(stream, x)
        ...
  end interface
  interface xdr_write
     ...
  end interface  
contains
   subroutine xdr_create(..)
      ...
   ! implementation using C level XDR calls
end module

The module itself wouldn't be portable, due to mixed C/Fortran programming
but the interface would be.

Of course something like
     open(LU, form = 'XDR')
would be much nicer, but would require the language specification
to be changed.

--
------------------------------------------------------------------------------

Simulog Sophia Antipolis, Les Taissounieres HB2,
Route des Dolines, 06560 Valbonne, France
------------------------------------------------------------------------------



Tue, 30 Jun 1998 03:00:00 GMT  
 
 [ 22 post ]  Go to page: [1] [2]

 Relevant Pages 
 

 
Powered by phpBB® Forum Software