
#include <lcio.h> const struct fattrib *fattr(FILE *f);
fattr function returns a pointer to a structure containing
information about the attributes of the stream associated with the
FILE object addressed by the f argument. The return
value is a pointer to a fattrib structure as defined in
<lcio.h>. Note that the returned pointer is a const
pointer, so you can inspect the structure fields but not modify them.
The fattrib structure is defined as
struct fattrib {
unsigned long props; /* file properties */
unsigned short abilities; /* how file can be used */
unsigned short reclen; /* maximum record length */
/* (0 if no limit) */
unsigned short blksize; /* block size or VSAM */
/* control interval size */
/* (0 if not meaningful) */
unsigned short keylen; /* key length or 0 */
unsigned short keyoff; /* record offset of key or 0 */
char am[5]; /* name of access method */
char _1[1]; /* reserved */
long _2[10]; /* reserved */
} ;
The props field of the fattrib structure is a bit string
composed of bits specifying whether the file has a number of specific
properties. The abilities field is a bit string specifying
whether the file supports specific file operations. Note that not all
bits of these fields are defined and that undefined bits do not have
to be set to 0.
The bit definitions for the props field are
_Fappend
_Fcommit
commit=yes was
specified or defaulted.
_Fdupkey
_Ffixed
_Fgeneric
_Finexact
_Fkeyed
_Fphyskey
_Fprintform
_Fprint
print=yes is in effect
for the file.
_Fprocess
fork or exec,
unless fcntl has prevented access.
_Frelative
_Fshared
_Fspanbuf
_Fspanrec
_Fstream
_Fterm
_Ftext
_Ftrunc
trunc=yes was
specified or defaulted.
The bit definitions for the abilities field are
_Fcan_delete
kdelete.
_Fcan_grow
_Fcan_read
_Fcan_rewind
_Fcan_setbuf
setbuf or
setvbuf
to define an I/O buffer. setbuf and setvbuf
can only be the first file operation. _Fcan_setbuf remains in
effect while a file is open.
_Fcan_search
ksearch.
_Fcan_seek
fsetpos.
_Fcan_skend
_Fcan_tell
fgetpos or kgetpos.
_Fcan_write
The reclen field of the fattrib structure includes space
for the key in a keyed file. Thus, for an ESDS or RRDS opened for
keyed access, the returned reclen value is 4 bytes greater than
the maximum physical record size. In all cases in which a non-zero
value is returned for reclen=, the value returned is the same
as would be specified by the reclen= amparm; that is, the value
is the same as the amount of storage required to read the largest possible
record in the file.
fattr function returns a pointer to an attrib
structure for the file. If the argument to fattr addresses a
closed file object, a pointer to a dummy fattrib structure is
returned with the abilities field equal to 0. If the argument
to fattr is an invalid FILE pointer, the results are
unpredictable.
#include <lcio.h>
#include <stdio.h>
main()
{
FILE *outfile;
outfile = afopen("tso:userid.test", "w", "",
"recfm=v, reclen=132");
if (fattr(outfile)->props & _Fprintform)
putc('f', outfile);
fclose(outfile);
}
cmsstat, fstat, osddinfo, osdsinfo,
stat
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.