Home | OS/2 Software | Rexx | Search the LIBPath for a DLL (Beginning level)

Search the LIBPath for a DLL (Beginning level)

Contributed by: Doug Rickman, Global Hydrology and Climate Center, MSFC, NASA

This is aimed at beginning REXX users.


 


/*****************************************************************************/
/***************  Search LIBPath for DLL.                      ***************/

/* Search the LIBPath for a DLL.  Returns:
      first occurence if found,
      -1 if Config.sys not found on "boot drive,"
      0 if file not found along LIBPath.

Doug Rickman Sept. 9, 1998. */
procedure
parse arg Target .

BootDrive = substr(value('COMSPEC',,'OS2ENVIRONMENT'),1,1)
Config_Sys=BootDrive':\config.sys'
call SysFileTree Config_Sys, files.
if files.0=1 then nop
else return -1

do while lines(Config_Sys)>0
   data=linein(Config_Sys)
   parse var data v1 '=' LIBPath
   if translate(v1)='LIBPATH' then leave
   end /* end do while lines() ... */

do while LIBPath\=''
   parse var LIBPath Directory ';' LIBPath
   call SysFileTree Directory||'\'||Target, files.
   if files.0=1 then return Directory
   end /* end do while LIBPath ... */

return 0