FILDES - get file descriptor word.

Alternate Entry Name: F.DESC

Usage:

B:
   descr = fildes( unit );
C:
   int fildes(FILE *unit);

Where:

unit
is the number of an I/O unit.
descr
is zero if the unit is not open, if it is a terminal, or if it is a string. Otherwise, "descr" is given a file descriptor as described below.

Description:

FILDES obtains the file descriptor word of an I/O unit. If "unit" is attached to a disk file, FILDES returns a descriptor with the following information.

 bits   mask     meaning
 ----   ----     -------
 0-5  770000,du  Device code (see below)
 6-8  007000,du  Disposition code (batch)
                 0 : release
                 1 : dismount
                 2 : save
                 3 : continue
 9-17            Unused
   18 400000,dl  Creation code
                 0 : file previously existed
                 1 : file created by open
   19 200000,dl  0 : sequential file
                 1 : random file
   20 100000,dl  0 : temporary file
                 1 : permanent file
   21 040000,dl  Permanent file dynamically accessed
22-35 037777,dl  Size of file in llinks

For other devices, bits 0-8 are as above. See the GCOS manual description of MME GEFADD for a description of the other bits.

Device Codes:

The following table gives the device name for each device code. "xxxxxx" means the code is unassigned.

000: xxxxxx .dc355 .dssf  .dmca  .dddia .dpfep .ddbcs .dhypr
010: .dmtap .dmta7 .dmta9 .dmtm7 .dmtm9 .dmtc7 .dmtc9 .dmtxx
020: .dcr20 .dcr21 .drp24 .dcp20 .dpr41 .dpr30 .dpr21 .dptap
030: .dcons .dscc1 .dcp30 .dcp31 .dcr31 .dpr33 .dpr23 .duncp
040: xxxxxx .dsm1b .dsm1a .dsm2b .dsm2a .dsm1d .dsm2c .dsm2d
050: .dss1b .dss1d .dss1f .dsc1b xxxxxx .dsd1b .dsk1b .dsk1c
060: .ds181 .ds190 .ds191 .ds310 .ds400 .ds450 .ds500 .ds501
070: .dss1a .dss1c .dss1e .dsc1a .dsm1e .dsd1a .dsk1a xxxxxx

For example, a device code of octal 12 in bits 0-5 refers to device ".dmta9" while a device code of octal 65 refers to device ".ds450".

In batch, a device code of 77 (octal) is used by ACC.FILE to indicate a SYSOUT filecode. For a description of the descriptor for a unit attached to a tape in batch, see the GCOS manual under MME GEFADD. A tape is recognized by a device code of the form 1x (octal).

See Also:

expl b bmac fildes
For symbolic names for the bit fields.
expl b lib f.size
for a routine that returns just the file size.

Copyright © 1996, Thinkage Ltd.