I have a problem with SysCls RexxUtil function. If I call this function as a procedure (i.e., Call SysCls) it works as expected, but if I call it as a function (i.e., SysCls()), an error appears: "0 is an unknown internal or external command" [I translate the error message from Spanish].
It seems the return code is issued as a OS command.
I use other RexxUtil functions without problem.
My OS is a Spanish W2K (at latest level available).
Anyone more with this problem?
Thanks,
Francesc Ross
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is not a problem with SysCls(), but rather standard Rexx behavior for any function call. Rexx is not the C language, so
call SysCls
and
SysCls()
are not the same thing. The first is a CALL instruction, which calls the SysCls utility function. The second is a COMMAND instruction, so the command expression is evaluated (your call to the SysCls() function), and the expression result is issued as a command to the current ADDRESS environment. You can see the same behavior using other functions. For example,
substr("echo Hello World", 1)
will display "Hello World" on a Windows system. To issue the function without making the instruction a command, you need to turn it into an assignment.
rc = SysCls()
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm note sure I understand what you mean by "as it is a String"....SysCls() returns a string. If it appears it is doing nothing, then it is because SysDriveInfo() actually returns a string that is a valid Windows command...it appeas like it is doing nothing because it is actually doing something! This is generally very dangerous to rely on!.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
SysDriveInfo("C:") returns a String (in my computer: "C: 97880567808 120031477760") I think this String is forwarded to the default environment (in my computer, "CMD") but CMD does nothing with the SysDriveInfo() returned string. May be the returned string is a valid Windows command, I think the command is C: and the parameters to this command ("97880567808 120031477760") are ignored.
In this case nothing happens but as you said, it is very, very dangerous. So the principle must be "If you call a function, assign the result to a variable". I'm wrong?
Francesc Ross
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have a problem with SysCls RexxUtil function. If I call this function as a procedure (i.e., Call SysCls) it works as expected, but if I call it as a function (i.e., SysCls()), an error appears: "0 is an unknown internal or external command" [I translate the error message from Spanish].
It seems the return code is issued as a OS command.
I use other RexxUtil functions without problem.
My OS is a Spanish W2K (at latest level available).
Anyone more with this problem?
Thanks,
Francesc Ross
This is not a problem with SysCls(), but rather standard Rexx behavior for any function call. Rexx is not the C language, so
call SysCls
and
SysCls()
are not the same thing. The first is a CALL instruction, which calls the SysCls utility function. The second is a COMMAND instruction, so the command expression is evaluated (your call to the SysCls() function), and the expression result is issued as a command to the current ADDRESS environment. You can see the same behavior using other functions. For example,
substr("echo Hello World", 1)
will display "Hello World" on a Windows system. To issue the function without making the instruction a command, you need to turn it into an assignment.
rc = SysCls()
I'm note sure I understand what you mean by "as it is a String"....SysCls() returns a string. If it appears it is doing nothing, then it is because SysDriveInfo() actually returns a string that is a valid Windows command...it appeas like it is doing nothing because it is actually doing something! This is generally very dangerous to rely on!.
Hi Rick,
SysDriveInfo("C:") returns a String (in my computer: "C: 97880567808 120031477760") I think this String is forwarded to the default environment (in my computer, "CMD") but CMD does nothing with the SysDriveInfo() returned string. May be the returned string is a valid Windows command, I think the command is C: and the parameters to this command ("97880567808 120031477760") are ignored.
In this case nothing happens but as you said, it is very, very dangerous. So the principle must be "If you call a function, assign the result to a variable". I'm wrong?
Francesc Ross
Yes, that's the principle!
Hi Rick,
Thanks for your answer. I don't remember this detail.
I suppose when I issue SysDriveInfo("C:") the returned value is forwarded to default environment but as it is a String W2K does nothing.
Thanks a lot for your work!
Francesc Ross