Rexx2Nrx.Rexx2RT.SysCmd ( vs 4.00, January 2003)

The class SysCmd is used to emulate System Commands. Note, that by default, any expression on statement level is thrown to the underlying command processor by classic Rexx, a feature which is no longer available in NetRexx. SysCmd is an implementation of this behaviour for NetRexx and Java.

You may overrule this behaviour by using option NOCMD for Rexx2Nrx. NOCMD will give you an error message, when a clause is reached which isn't either an assignment statement nor one of the 'reserved' structural statements of classic Rexx.

But, as mentioned above, by default those statements are regarded as 'commands'.

Mixing commands  with ordinary language statements has had many advantages, but also did cause many inadvertant errors, when misspellings occured. Therefore, it probably is better to make this execution of System commands explicit in the language, as NetRexx does it.

To use this system commands, the following statements are generated by Rexx2Nrx:

Import Rexx2Nrx.Rexx2RT.SysCmd

Class class-name[parameters] USES SysCmd, ...

In summary, the following methods are available:

method cmd(cmd_line=Rexx) public static returns int

executes the system command given in cmd_line. The error returns code RC is returned, which is zero when the command has been executed sucessfully.

Note, that a couple of frequent System commands like 'ERASE'. '@DEL' (OS/2), 'MAKEBUF', 'DESBUF', etc are directly executed using the available Java methods, thus eliminating the overhead needed to call the command processor at all.

 Also, a special algorithm is used to locate the proper execution method. Assume, your command is 'XXX':

when XXX.class exists, then this JAVA-class is executed.

when XXX.bat  exists, then this batch file is executed.

when XXX.exe exists, than this EXE-file is executed.

when XXX.cls  exists, then this Object Rexx class is executed.

when XXX.rexx exists, then your current REXX processor is invoked.

when XXX.rex  exists, then Object Rexx is invoked

otherwise, and only then:

     we have no chance, we need to execute 'COMMAND.COM' (Windows 95/97/NT) or CMD.EXE (Windows XP) on Windows systems (Don't yet know what to do in UNIX, advise will be welcome)

Any parameters present in the cmd_line are passed without any changes.

method trace(flag = boolean 1) public static

This is an auxiliary method to force tracing of all subsequent System commands.

SysCmd.trace(1) turns tracing on, and SysCmd.trace(0) turns tracing off.