home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
mtseek.zip
/
PROCTHRD.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-10-02
|
1KB
|
50 lines
/* PROCTHRD.CMD */
/* This thread perform some calculation. For this example */
/* this thread finds selected files and searches text within files. */
parse arg qname semname filenames searchtext
MainThread:
/* setting to the queue */
rc = rxqueue("set", qname)
Call SendMessage "Searching for files...Please wait..."
/* Get List of files commands */
ok = SysFileTree(filenames, 'files.', 'FSO')
call SendMessage "Now searching each file."
/* search each file */
do i = 1 to files.0
if \SemaphorePresent(semname) then /* if no semaphore present stop processing */
signal cleanup
/* otherwise search the file for the text */
if SysFileSearch(searchtext, files.i, 'lines.', 'N') = 0,
& lines.0 > 0 then do
message = "FILE" files.i lines.1
call SendMessage message /* report file found */
end
end /* for each file */
call SendMessage "End of list."
CleanUp:
/* some clean up could occur here */
exit
SendMessage: Procedure,
expose semname
message = arg(1)
if SemaphorePresent(semname) then
queue message
else
signal CleanUp
return
SemaphorePresent: Procedure
return stream(arg(1), 'c', 'query exists') <> ''