Chapter Contents

Previous

Next
FINFO

FINFO



Returns the value of a file information item

OS/390 specifics: info-item


Syntax
Details
Example 1: Sequential File Information
Example 2: PDS, PDSE Member Information
Example 3: UNIX System Services File Information
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 the number of the information item that is to be retrieved.


Details

The FINFO function returns the value of a specified information item for an external file that was previously opened and assigned a file-id by the FOPEN function.

The FINFO, FOPTNAME, and FOPTNUM functions support the following information items.

Information Items for Unix System Services Files
Item Item Identifier Definition
1 File Name File name
2 Access Permission Read, write, and execute permissions for owner, group, and other
3 Number of Links Number of links in the file
4 Owner Name User ID of the owner
5 Group Name Name of the owner's access group
6 File Size File size
7 Last Modified Date file last modified

Information Items for Sequential Files and members of PDSs and PDSEs
Item Item Identifier Definition
1 Dsname File name
2 Unit Disk type
3 Volume Volume on which data setresides
4 Disp Disposition
5 Blksize Block size
6 Lrecl Record length
7 Recfm Record format


Example 1: Sequential File Information

The following example generates output that shows the information items available for a sequential data set:

data _null_;
   length opt $100 optval $100;

   /* Allocate file  */
   rc=FILENAME('myfile', 
      'userid.test.example');
   
   /* Open file */
   fid=FOPEN('myfile');

   /* Get number of information
      items */
   infocnt=FOPTNUM(fid);

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

   /* Close the file */
   rc=FCLOSE(fid);

   /* Deallocate the file */
   rc=FILENAME('myfile');
run;

Example 1 Output: Sequential File Information
Information for a Sequential File:
Dsname             USERID.TEST.EXAMPLE
Unit               3380
Volume             ABC010
Disp               SHR
Blksize            23392
Lrecl              136
Recfm              FB

NOTE: The DATA statement used 0.10 
   CPU seconds and 5194K.


Example 2: PDS, PDSE Member Information

This next example shows the information items availabile for PDS and PDSE members:

data _null_;
  length opt $100 optval $100;

  /* Allocate file  */
  rc=FILENAME('myfile', 
     'userid.test.data(oats)');
   
  /* Open file */
  fid=FOPEN('myfile');

  /* Get number of information 
     items */
  infocnt=FOPTNUM(fid);

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

  /* Close the file */
  rc=FCLOSE(fid);

  /* Deallocate the file */
  rc=FILENAME('myfile');
run;

Example 2 Output: PDS, PDSE Member Information
Information for a PDS Member:
Dsname             USERID.TEST.DATA(OATS)
Unit               3380
Volume             ABC006
Disp               SHR
Blksize            1000
Lrecl              100
Recfm              FB

NOTE: The DATA statement used 0.05 
   CPU seconds and 5194K.


Example 3: UNIX System Services File Information

This final example shows the information items available for UNIX System Services files:

data _null_;
   length opt $100 optval $100;

   /* Allocate file  */
   rc=FILENAME('myfile', 
      '/u/userid/one');
   
   /* Open file */
   fid=FOPEN('myfile');

   /* Get number of information 
      items */
   infocnt=FOPTNUM(fid);

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

   /* Close the file */
   rc=FCLOSE(fid);

   /* Deallocate the file */
   rc=FILENAME('myfile');
run;

Example 3 Output: UNIX System Services File Information
Information for a UNIX 
   System Services File:
File Name          /u/userid/one
Access Permission  --rw-rw-rw-
Number of Links    1
Owner Name         USERID
Group Name         GRP
File Size          4
Last Modified      Apr 13 13:57

NOTE: The DATA statement used 
   0.07 CPU seconds and 5227K.


See Also


Chapter Contents

Previous

Next

Top of Page

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