| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Erasing A String |
Excerpted from message dated 06-27-95, Peter Hansen to Andrew Batiuk:
PH> /* load library functions */
>if RxFuncAdd('SysFileTree', 'RexxUtil', 'SysFileTree') = 0 then
> _abort('Unable to load RexxUtil functions')
Peter--
You have a couple of problems in the above statements from your REXX
program. A "good" external-function registration returns a zero. If it
didn't register, it returns a 1. If your program worked at all, it was
because SysFileTree had already been registered by a previous call to
RxFuncAdd.
Once an OS/2 REXX program has registered an external function (in
this case, SysFileTree), that function is registered for any REXX
program run in the system until shutdown, unless that function is
de-registered with RxFuncDrop. Since a registered external function
cannot be re-registered, further attempts to register the same function
will return a "1" as the "failure" response.
If you want to find out whether or not a function is already
registered, you can use RxFuncQuery. Of course, there is a booby trap!
RxFuncQuery only tells you whether or not the function is registered; it
doesn't check to see if the DLL is available to the program!
Try (assuming bar.dll isn't in your system):
--------------------
/* TEST.CMD - a lesson */
say RxFuncAdd('foo','bar','foo')
say RxFuncQuery('foo')
call 'foo'
return
---------------------
The first time you run this little program, you will get two lines
with zeros, followed by a "Routine not found" error return on the
"call
'foo'" source line. If you run it again, you will get a "1" on the
first line of output instead of the former "0" with the rest of the
output unchanged.
You could write a usable run-time check for the missing DLL by using
a SIGNAL ON SYNTAX error trap (see the IBM manual "Procedure Language 2/
REXX Reference"--IBM p/n 10G6268; the on-line documentation on this
subject is essentially useless). But all the error trap can do is to
add a consoling message (as does your _abort procedure) before
terminating the program, since there is no recovery from a missing DLL!
I don't bother in my REXX utilities, because I know that a "Routine not
found" error means the program couldn't find the DLL. But it might be
nice to use the trap if you are writing REXX programs for others.
As written, your program would abort if called in a "clean" system.
Or, if you had written the test as "/= 0" it would self-destruct on any
second calls. You are not alone in trying to use this useless test. It
is also found (with the second-time self-destruct problem) in one of the
sample programs that comes with the current OS/2 PL/I compiler--the one
supposedly demonstrating how to write OS/2 REXX external functions as
PL/I DLLs.
--Murray
___
* MR/2 2.23 #120 * One printed manual is worth a thousand INF files
---
* Origin: 2" x 4" bbs - a basic board - (914) 271-9407 (1:2625/108)SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 2625/108 1 109/7 3615/50 396/1 270/101 105/103 42 712/515 711/808 809 @PATH: 711/934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.