Functions and CALL Routines under 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 Language Reference: Dictionary
|
-
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:
|
Information Items Available For... |
nval
|
Single File |
Pipe Files |
Concatenated Files |
1 |
File Name |
PIPE Command |
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) |
FOPTNAME returns a blank if an error occurs.
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:
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.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.