🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.super
Article #430

Re: CRAY-YMP Fortran-to-C question

#430
From: Stephen O. Gombosi
Date: Wed, 05 Jun 1991 16:20
63 lines
3901 bytes
In article <Jun.4.16.30.17.1991.306@arakis.rutgers.edu> figuei@arakis.rutgers.edu (Francisco Figueirido) writes:
>
>I am trying to write a program (in C) which needs to read data from a
>file which was created by a Fortran-written program. The file in
>question consists of unformatted (i.e., binary) data. I know that the
>CRAY (I am using the one at PSC) writes, as most Fortran compilers,
>some sort of count (word count?) before the records, but cannot make
>sense of everything I see in the octal dump. Can someone direct me to
>where can I get more information about the format of unformatted (no
>pun intended!) files? Thanks for the help.

The file is a "Cray Blocked" file. This was the standard file format on
the COS operating system.

The file consists of 512 word (4KB) blocks, each of which is headed by
a "block control word" or BCW. In addition, records within the file are
delimited by "record control words", or, you guessed it, RCWs. The format
of these control words should be contained in the header file:
  /usr/lib/libio/cos/cosio.h

Unless they've moved them since I last needed them. I'd just look around
for "cosio.h". Here is a quick synopsis:

BCW:

Field      Bits (high-order==0)    Meaning
 m            0 - 3                CW type (0 == BCW)
 bdf          11                   "bad data flag" (should be unused)
 bn           31-54                Block number (modulo 2**24)
 fwi          55-63                Forward Index (# words to next CW)


RCW:

RCWs come in three flavors: End-Of-Record (EOR), End-Of-File (EOF), and
End-Of-Data (EOD). A COS dataset (which corresponds to a UNICOS "file")
may contain more than one COS "file" (this is sort of like a "partition"
on some other operating systems. Don't worry about it - terminology doesn't
transfer...

Field      Bits (high-order==0)   Meaning
 m           0-3                  CW type (octal 010==EOR, 016==EOF, 017
                                           ==EOD)
 ubc         4-9                  Unused bit count (number of unused low order
                                  bits in the last word of the record)
 tran        10                   Don't worry about this one
 bdf         11                   See above
 srs         12                   Ditto
 pfi         20-39                Previous file index (may be unused)
 pri         40-54                Previous record index; offset modulo
                                  2**15 to block where current record starts
                                  (intended to allow fast backspacing)
 fwi         55-63                forward index; # of words to next CW.

Every "full-record" binary write or buffer out produces an EOR-delimited
record. A FORTRAN ENDFILE produces an empty record followed by an EOF.
All this should look familiar if you ever worked on a 7600, or used
Cyber Record Mangler (so what if the words are a LITTLE bigger?).

If you need more help, let me know...

-Steve Gombosi  sgombosi@isis.cs.du.edu
"Just another ex-Crayon"
Technical Details
Message-ID: <1991Jun5.162004.16668@mnemosyne.cs.du.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mnemosyne.cs.du.edu!isis.cs.du.edu!sgombosi
References: <Jun.4.16.30.17.1991.306@arakis.rutgers.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mnemosyne.cs.du.edu!isis.cs.du.edu!sgombosi
From: sgombosi@isis.cs.du.edu (Stephen O. Gombosi)
Newsgroups: comp.sys.super
Subject: Re: CRAY-YMP Fortran-to-C question
Keywords: Fortran, C, CRAY, I/O
Message-ID: <1991Jun5.162004.16668@mnemosyne.cs.du.edu>
Date: 5 Jun 91 16:20:04 GMT
References: <Jun.4.16.30.17.1991.306@arakis.rutgers.edu>
Sender: usenet@mnemosyne.cs.du.edu (netnews admin account)
Reply-To: sgombosi@isis.UUCP (Stephen O. Gombosi)
Organization: Nyx, Public Access Unix (sponsored by U. of Denver Math/CS dept.)
Lines: 63
Disclaimer1: Nyx is a public access Unix system run by the University of
Disclaimer2: Denver for the Denver community.  The University has neither
Disclaimer3: control over nor responsibility for the opinions of users.