Chapter Contents

Previous

Next
DREAD

DREAD



Returns the name of a directory member

Category: Directory


Syntax
Details
Example
See Also

Syntax

name=DREAD(directory-id,member-num);

name
contains either the name of the member, or a blank if an error occurs (for example, if nval is out-of-range).

Type: Character

directory-id
contains the identifier that was assigned when the directory was opened. If directory-id is invalid, the program halts.

Type: Numeric

member-num
is the sequence number of the member within the directory.

Type: Numeric


Details

Use DNUM to determine the highest possible member number that can be passed to DREAD. DREAD works only if the directory was previously opened by the DOPEN function.


Example

Open the directory identified by the fileref MYDIR, retrieve the number of members and place the number in the variable MEMCOUNT, retrieve the name of the last member and place the name in the variable LSTNAME, and then close the directory:

   /* Assign the fileref MYDIR to the          */
   /* filename stored in the variable DIRNAME  */
   /* and open it.                             */
rc=filename('mydir',dirname);
dirid=dopen('mydir')
lstname='';
memcount=dnum(dirid);
if (memcount>0) then
   lstname=dread(dirid,memcount);
rc=dclose(dirid);

See Also

DNUM

DOPEN


Chapter Contents

Previous

Next

Top of Page

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