[mod.computers.vax] Getting file attributes

PENSTONE@QUCDNEE1.BITNET.UUCP (01/13/87)

< How does one determine from inside a program whether an existing disk file
< (FORM="UNFORMATTED") is RECORDTYPE="VARIABLE"  .....

        There is a C function stat() that returns some information about
a file. It puts it into a structure which is described in stat.h of the
C library. The values to look for in the "record format" and
"record attributes" values are described in fab.h. You can identify
the values FAB$C_FIX or FAB$C_VAR in the st_fab_rfm field of the structure
filled by the stat() call, and the record attributes in the st_fab_rat field.
If that doesn't work, then you will have to use the dreaded FAB and RAB
calls provided in RMS ! (Not really as terrifying as they look; an
afternoon's reading of the RMS manuals will usually suffice...they work
well from C, but are a bit more of a pain in FORTRAN because of the difficulty
of creating structures.)

Sid Penstone
Dept. Of Electrical Engineering,
Queen's University, Kingston, Ontario, Canada
PENSTONE@QUCDNEE1.BITNET

garry@TCGOULD.TN.CORNELL.EDU.UUCP (01/15/87)

In a recent article Sid Penstone said:
>< How does one determine from inside a program whether an existing disk file
>< (FORM="UNFORMATTED") is RECORDTYPE="VARIABLE"  .....
>
>        There is a C function stat() that returns some information about
>a file. ..............      You can identify
>the values FAB$C_FIX or FAB$C_VAR in the st_fab_rfm field of the structure
>...

I'm sorry; this won't work. As I explained privately to the original
poster, "Segented" records are a concept known *only* to Fortran. They
consist of variable records with a couple extra bytes tacked on; the
entire rest of the universe just sees plain variable records and isn't
aware that there's extra information in there.

BTW, FAB$C_FIX refers to "fixed-length" records. Is something different.

(But I'm glad to know stat() returns actual RMS info - could be handy!)

garry wiegand   (garry%cadif-oak@cu-arpa.cs.cornell.edu)