Chapter Contents

Previous

Next
FINFO

FINFO



Returns the value of a file information item

CMS specifics: info-item


Syntax
Details
FINFO Output for Disk Files
FINFO Output for Sequential Files
See Also

Syntax

FINFO (file-id,info-item)

file-id
specifies the identifier that was assigned when the file was opened (generally by the FOPEN function).

info-item
specifies a number that represents an information item, the value of which will be returned by the function.


Details

The following table defines the information that is returned for a given info-item value.

Defining File Information Items
info-itemValue Information Items Available For...
Single Files Concatenated Files
1 file name file name
2 owner name file list
3 group name owner name
4 access permission group name
5 file size (bytes) access permission
6
file size (bytes)


FINFO Output for Disk Files

The following example and output illustrate the use of FINFO and the other file access functions for disk files:

data _null_;
   length opt $100 optval $100;
   rc=FILENAME('myfile', 'finfo list *'); /* allocate file   */
   fid = FOPEN('myfile');                 /* open file       */
   infocnt=FOPTNUM(fid);  /* get number of information items */

   /* Retrieve information items and print to log*/
   put @1 'Information for a File:';
   do j=1 to infocnt ;
      opt = FOPTNAME(fid,j);
      optval  = FINFO(fid,upcase(opt));
      put @1 opt @20 optval;
   end;

   rc = FCLOSE(fid);                      /* close file      */
   rc = FILENAME('myfile');               /* deallocate file */
run;                           

FINFO Output for a Disk File
             
Information for a File:                  
File Name          FINFO LIST A          
Lrecl              80                    
Recfm              F  
Blksize            960    
NOTE: DATA statement used:      
      real time           0.86 seconds   
      cpu time            0.27 seconds   

     


FINFO Output for Sequential Files

The following example and output illustrate the use of FINFO and the other file access functions for sequential files:

data _null_;
   length opt $100 optval $100;
   rc=FILENAME('myfile', 'sltape sas .saspgms'); /* allocate file */
   fid = FOPEN('myfile');                        /* open file     */
   infocnt=FOPTNUM(fid);       /* get number of information items */

   /* retrieve information items and print to log*/
   put @1 'Information for a File:';
   do j=1 to infocnt;
      opt = FOPTNAME(fid,j);
      optval  = FINFO(fid,upcase(opt));
      put @1 opt @20 optval;
   end;

   rc = FCLOSE(fid);                       /* close file          */
   rc = FILENAME('myfile');                /* deallocate the file */
run;        

FINFO Output for a Sequential File
                              
 Information for a File:                            
 File Name          SLTAPE SAS SFSFP:USER1.SASPGMS 
 Lrecl              80                              
 Recfm              F    
 Blksize            960                             
 NOTE: DATA statement used:                        
       real time           0.15 seconds         
       cpu time            0.13 seconds          


See Also


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.