ファイル情報項目の値を返します。
| カテゴリ: | 外部ファイル |
(通常、FOPEN関数で)ファイルを開いたときに割り当てられた識別子を指定する数値定数、変数または式です。
取得するファイル情報項目の名前を指定する文字定数、変数または式です。Information-itemは、ファイル情報名または引用符で囲まれたファイル情報名を含む変数です。
|
項目
|
項目識別子
|
定義
|
|---|---|---|
|
1
|
Filename
|
ファイル名
|
|
2
|
Access Permission
|
所有者、グループおよびその他の読み取り権限、書き込み権限および実行権限
|
|
3
|
Number of Links
|
ファイルのリンクの数
|
|
4
|
所有者名
|
所有者のユーザーID
|
|
5
|
グループ名
|
所有者のアクセスグループの名前
|
|
6
|
File Size
|
ファイルのサイズ
|
|
7
|
Last Modified
|
ファイルが最後に変更された日付
|
|
8
|
Created
|
ファイルが作成された日付
|
data info;
length infoname infoval $60;
drop rc fid infonum i close;
rc=filename('abc', 'physical-filename');
fid=fopen('abc');
infonum=foptnum(fid);
do i=1 to infonum;
infoname=foptname(fid, i);
infoval=finfo(fid, infoname);
output;
end;
close=fclose(fid);
run;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;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.
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;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.
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;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.