Previous Page | Next Page

Functions and CALL Routines under z/OS

FINFO Function: z/OS



Returns the value of a file information item for an external file.
Category: External Files
z/OS specifics: info-item
See: FINFO Function in SAS Language Reference: Dictionary

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. The info-item argument is a character value.


Details

FINFO returns the value of a system-dependent information item for an external file that was previously opened and assigned a file-id by the FOPEN function. FINFO returns a blank if the value given for info-item is valid.

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

Information Items for UNIX System Services Files
Item Item Identifier Definition
1 Filename Filename
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
8 Created Date file created

Information Items for Sequential Files and Members of PDSs and PDSEs
Item Item Identifier Definition
1 Dsname Filename
2 Unit Disk type
3 Volume Volume on which data set resides
4 Disp Disposition
5 Blksize Block size
6 Lrecl Record length
7 Recfm Record format
8 Creation Date file created


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;

Sequential File Information

Information for a Sequential File:
Dsname             USERID.TEST.EXAMPLE
Unit               3390
Volume             ABC010
Disp               SHR
Blksize            23392
Lrecl              136
Recfm              FB
Creation           2007/11/20

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

Example 2: PDS, PDSE Member Information

This example shows the information items available 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;

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
Creation           2007/11/05

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

Example 3: UNIX System Services File Information

This 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;

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
Created            Mar 16 09:55

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

See Also

Previous Page | Next Page | Top of Page