Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

@REXX

Aug
1,904
68
Why am I getting the;
Code:
TCC: Unknown command "4"
ECHO is OFF
as shown below? The output should just be 4.

I tried the example from the help file;
Code:
c:\program files\rexx.org\regina>echo %@rexx[ = 3 * 4 ]
TCC: (Sys) The parameter is incorrect.
 "%@rexx[ = 3 * 4 ]"

but it does not work as it should.

Joe

Code:
c:\program files\rexx.org\regina>ver

TCC  22.00.38 x64   Windows 7 [Version 6.1.7601]

c:\program files\rexx.org\regina>rexx --version
rexx: REXX-Regina_3.9.1 5.00 5 Apr 2015 (64 bit)

c:\program files\rexx.org\regina>set regina*
REGINA_HOME=C:\Program Files\rexx.org\Regina
REGINA_LANG=en
REGINA_LANG_DIR=C:\Program Files\rexx.org\Regina

c:\program files\rexx.org\regina>echo %@rexx[words('The quick brown fox')]
TCC: Unknown command "4"
ECHO is OFF

1518986758620.png
 
Process Explorer shows that the REGINA.DLL is in the tcc.exe process;

1519124345264.png


Code:
c:\users\jlc\utils>type test.rexx
Say('Test')

c:\users\jlc\utils>rexx test.rexx
Test

c:\users\jlc\utils>test.rexx
Test

Joe
 
What I suspect is happening here, is that Windows is indeed finding REGINA.DLL, since I can reproduce all of Joe's errors. Changing his WORD example to a five word expression, gives an answer of 5, and putting 'REXX[3*4]' as the command gives a command not found '12'.

Code:
[1:\]echo %@rexx[reverse('ydneW')]
TCC: Unknown command "Wendy"
ECHO is OFF

[2:\]%@rexx[echo reverse('ydneW')]
Wendy

[3:\]echo %@rexx[reverse('ydneW'); 12]
TCC: Unknown command "Wendy"
TCC: Unknown command "12"
ECHO is OFF

[4:\]echo %@rexx[reverse('ydneW')] %@rexx[3*4]
TCC: Unknown command "Wendy"
TCC: Unknown command "12"
ECHO is OFF

[5:\]echo %? %_? %@rexx[reverse('ydneW')]
TCC: Unknown command "Wendy"
2 1

[6:\]echo %? %_? %@rexx[echo reverse('ydneW')]
Wendy
2 0

The user expectation is that the command ought expand to 'echo Wendy', and then the line out is 'Wendy'. This is a particularly tricky issue, since REXX is intended to pass any unknown words through to the calling process. This is how Rexx is intended to work, but not really what the users expect %@REXX[] to do.
REXX is IBM's glue language, and is thus designed to pass unknown functions back to the caller. In example 2 above, 'echo' is not a REXX function, and so the string evaluates to 'echo Wendy' but passed directly to the command-line of 4NT and TCC (it exists in vers 8.01.70, which i still use too.)


The bug could exist in the way that the return command is passed back from REGINA to TCC. What is happening is that regina is expecting tcc to run the command at its prompt. TCC is then running the command and then running echo with a null parameter.

We see in either 3 and 4, REXX has produced two consecutive commands, which are 'Wendy' and '12' before displaying the prompt.

The immediate fix is to use something like %@REXX['set y1=' reverse('ydneW')] followed by something like echo %y1. If you are using older versions this might be a suitable cure.

At 5 and 6, we see the error-levels, external and internal, when REXX[] evalues to an unknown command, or to something that TCC can execute.
 
Code:
c:\users\jlc\utils>rexx <<< words('The quick brown fox')
TCC: Unknown command "4"

c:\users\jlc\utils>rexx <<< say(words('The quick brown fox'))
4

c:\users\jlc\utils>echo %@execstr[rexx <<< say(words('The quick brown fox'))]
4

Joe
 
Without the leading '=', REXX will attempt to call TCC to evaluate the result (this is the same as prefixing the argument with "return"):

Code:
[D:\TakeCommand22\TCConsole]echo %@rexx[= 3 * 4]
12

[D:\TakeCommand22\TCConsole]echo %@rexx[return 3 * 4]
12

[D:\TakeCommand22\TCConsole]echo %@rexx[3 * 4]
TCC: Unknown command "12"
ECHO is OFF

[D:\TakeCommand22\TCConsole]
 
Code:
c:\users\jlc\utils>echo %@rexx[return words('The quick brown fox')]
4

c:\users\jlc\utils>echo %@rexx[=words('The quick brown fox')]
4

Just need updates to the help file. Thanks for the clarification.

Joe
 
Back
Top