FOPTNAME Function


FOPTNAME Function

Returns the name of an item of information about a file

Category: External Files

See: FOPTNAME Function in the documentation for your operating environment.

Syntax

FOPTNAME ( file-id , nval )

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 information item.

Details

FOPTNAME returns a blank if an error occurred.

Operating Environment Information: The number, value, and type of information items that are available depend on the operating environment.

Examples

Example 1: Retrieving File Information Items and Writing Them to the Log

This example retrieves the system-dependent file information items that are available and writes them to the log:

 %let filrf=myfile;  %let rc=%sysfunc(filename(filrf,  physical-filename  ));  %let fid=%sysfunc(fopen(&filrf));  %let infonum=%sysfunc(foptnum(&fid));  %do j=1 %to &infonum;     %let name=%sysfunc(foptname(&fid,&j));     %let value=%sysfunc(finfo(&fid,&name));     %put File attribute &name equals &value;  %end;  %let rc=%sysfunc(fclose(&fid));  %let rc=%sysfunc(filename(filrf)); 

Example 2: Creating a Data Set with Names and Values of File Attributes

This example creates a data set that contains the name and value of the available file attributes:

 data fileatt;     length name $ 20 value $ 40;     drop rc fid j infonum;     rc=filename("myfile","  physical-filename  ");     fid=fopen("myfile");     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;     rc=filename("myfile");  run; 

See Also

Functions:

  • 'DINFO Function' on page 501

  • 'DOPTNAME Function' on page 505

  • 'DOPTNUM Function' on page 506

  • 'FCLOSE Function' on page 519

  • 'FILENAME Function' on page 529

  • 'FINFO Function' on page 539

  • 'FOPEN Function' on page 550

  • 'FOPTNUM Function' on page 553

  • 'MOPEN Function' on page 656




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net