Chapter Contents

Previous

Next
DREAD

DREAD



Returns the name of a directory member

Category: External Files


Syntax
Arguments
Details
Examples
See Also

Syntax

DREAD(directory-id,nval)

Arguments

directory-id
specifies the identifier that was assigned when the directory was opened, generally by the DOPEN function.
Restriction: The directory must have been previously opened by using DOPEN.

nval
specifies the sequence number of the member within the directory.


Details

DREAD returns a blank if an error occurs (such as when nval is out-of-range). Use DNUM to determine the highest possible member number that can be passed to DREAD.


Examples

This example opens the directory identified by the fileref MYDIR, retrieves the number of members, and places the number in the variable MEMCOUNT. It then retrieves the name of the last member, places the name in the variable LSTNAME , and closes the directory:

%let filrf=mydir;
%let rc=%sysfunc(filename(filrf,physical-name));
%let did=%sysfunc(dopen(&filrf));
%let lstname=;
%let memcount=%sysfunc(dnum(&did));
%if &memcount > 0 %then
   %let lstname=%sysfunc(dread(&did,&memcount));
%let rc=%sysfunc(dclose(&did));

See Also

Functions:

DNUM
DOPEN


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.