[Info-vax] Portable OpenVMS binary data format?

Steven Schweda sms.antinode at gmail.com
Mon Aug 6 22:56:14 EDT 2018


> > what does "multiple columns" mean? 
> 
> I think he means a two dimensional array.
> 
> Yes, that's correct!  So many different ways to say this
> depending on the audience... 

   So many ambiguous/bad ways.  In my experience, computer
data storage generally involves a set of sequential
locations, with no intrinsic columnar organization.  See code
below.  (30-odd years of writing C almost exclusively seems
to have damaged my formerly adequate Fortran skills.  Sigh.)


> [...] FORM='UNFORMATTED',RECORDTYPE='STREAM_LF')

   And what happens when "0x0A" appears in the (binary) data?


its $ type iu1.for
      program iu1

      integer* 4 d1( 6)
      integer* 4 d2( 2, 3)

      equivalence (d1, d2)

      integer* 4 i, j

      do i = 1, 6
        d1( i) = i
      end do

      open (unit = 1, file = 'iu1.out', form = 'UNFORMATTED',
     1 recordtype = 'fixed', recl = 1, status = 'NEW')

      do i = 1, 6
        write (1) d1( i)
      end do

      write (1) -1

      do j = 1, 3
        do i = 1, 2
          write (1) d2( i, j)
        end do
      end do

      end

its $ dump /byte /width = 80 iu1.out
[...]
 00 00 00 04 00 00 00 03 00 00 00 02 00 00 00 01 ................ 000000
 00 00 00 01 FF FF FF FF 00 00 00 06 00 00 00 05 ................ 000010
 00 00 00 05 00 00 00 04 00 00 00 03 00 00 00 02 ................ 000020
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 ................ 000030

   Note first that a multi-dimensional array and an
equivalent one-dimensional array can be used interchangeably. 
(Columns, shmolumns.)

   Second, fixed-length records can be impervious to the kind
of end-of-record delimiters which are a hazard in a
Stream_LF-delimited file.

   "other systems (linux mainly)" does not reveal the
endianness involved, which may depend on the underlying
hardware.  However, byte swapping is pretty easy when you
know the size of the data being byte-swapped.


> The binary FP numbers indeed need to be written in IEEE
> format. 

   I did ask about that a while ago:

> > Which format(s) are you using internally?
> 
>    Still a mystery.  HELP FORTRAN /FLOAT
> IEEE should be what's expected everywhere else these days. 



More information about the Info-vax mailing list