CompuServe Thread

#to rx or not to rx

3 messages in this thread
#45401From: Bart MathiasJan 28, 1995 2:20 PM
I can't figure out from my WShell manual why I get the following kind of results when I run a certain ARexx program by typing its name at the prompt: –> 1 Unknown command 1 30 *-* open('newtext',outfile,'w'); +++ Command returned 20 –> 77 Unknown command 77 52 *-* writeln('newtext',outline); +++ Command returned 20 –> 1 Unknown command 1 52 *-* writeln('newtext',outline); +++ Command returned 20 If I type rx at the prompt, followed by the program name, it runs with no backtalk. What additional info should I provide, in order that someone could answer my query? Bart Mathias
#45405From: Bob ChapmanJan 28, 1995 11:55 PM
Bart – Just a comment, but have you remembered that 'open' and 'writeln' are functions that return values — open returns '1' for success and writeln returns the # of characters written (if I remember rightly). Consequently, if you don't assign that returned value or use the 'call' statement to specifically ignore it — then ARexx passes the returned value to the current external environment to be executed as a command. You can use 'say address()' to see what the current external environment is, but it is unlikely that returned values like '1', '77', or whatever will be good commands for that environment — leading to the 'Unknown command' messages. 🙂 Try (for example) things like: if ~open('newtext',outfile,'w') then do say "Can't open the file!!!" exit 20 end or call writeln 'newtext', outline and see if that doesn't make a difference. ——
#45484From: Bill HawesFeb 5, 1995 9:28 AM
Bart, The funny "unknown command" errors you're seeing are the result of the function returns from OPEN(), etc. being interpreted as a command. You should either capture the return in a variable (e.g. test = open(…)) or use the CALL instruction to invoke the function. The reason the messages seem to go away when you use the RX command to run the program is that the default host for commands is being changed from WShell (which reports unknown command errors) to AREXX (which just silently returns the error.) In both cases unwanted commands are being issued. -Bill Hawes