FOPTNAME Function: UNIX

Returns the name of an item of information about an external file.
Category: External Files
UNIX specifics: Information items available
See: FOPTNAME Function in SAS Functions and CALL Routines: Reference

Syntax

FOPTNAME(file-id, nval)

Required Arguments

file-id
specifies the identifier that was assigned when the file was opened, generally by the FOPEN function.
nval
specifies the number of the file information item to be retrieved. The following table shows the values that nval can have in UNIX operating environments for single, pipe, and concatenated files:
File Information Items
nval
Single File
Pipe Files
Concatenated Files
1
Filename
PIPE Command
Filename
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)

Details

FOPTNAME returns a blank if an error occurs.

Example: File Attributes When Using the Pipe Device Type

The following example creates a data set that contains the NAME and VALUE attributes returned by the FOPTNAME function when you are using pipes:
data fileatt;
   length name $ 20 value $ 40;
   drop fid j infonum;
   filename mypipe pipe 'UNIX-command';
   fid=fopen("mypipe","s");
   infonum=foptnum(fid);
   do j=1 to infonum;
      name=foptname(fid,j);
      value=finfo(fid,name);
      put 'File attribute' name 'has a value of ' value;
      output;
   end;
run;
The following statement should appear in the SAS log.
SAS Log Output
File attribute Pipe Command has a value of UNIX-command
Unix-command is the UNIX command or program where you are piping your output or where you are reading your input. This command or program must be either fully qualified or defined in your PATH environment variable.

See Also

Functions:
FOPEN Function in SAS Functions and CALL Routines: Reference