![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
| fattr | 
| Portability: | SAS/C extension | 
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| EXAMPLE | |
| RELATED FUNCTIONS | |
| SEE ALSO | 
| SYNOPSIS | 
#include <lcio.h> const struct fattrib *fattr(FILE *f);
| DESCRIPTION | 
The 
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
The bit definitions for the 
abilities
 field
are
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.
| RETURN VALUE | 
The 
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.
| EXAMPLE | 
#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);
}
| RELATED FUNCTIONS | 
cmsstat
, 
fstat
, 
osddinfo
, 
osdsinfo
, 
stat
| SEE ALSO | 
![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
![]() Top of Page  | 
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.