A command line instruction consists of a single expression, followed by an instruction terminator. Click here to review how commands are distinguished from other instructions.
This instruction delivers the value of the expression as a command to the current command processing environment. The target environment can be altered by the address instruction. While the command is in progress, the Rexx program will be awaiting its completion, indefinitely. When the command eventually finishes, the command's completion code is assigned to the special RC variable.
Subsequent processing can be affected by the trapping of ERROR or FAILURE conditions. Trapping of these conditions is activated by the call ON or signal ON instructions. When a command completes with a failure condition, the Rexx program might choose to discontinue execution immediately, after displaying an appropriate message.
The completion of commands can also be implicitly traced during execution. Tracing of command completions is activated by the trace ERROR or trace FAILURE instructions. The default trace setting is NORMAL, which causes commands which completed with failure status to be traced.
Warning: some commands may permanently endanger your system or files within your file system. You should take suitable precautions to backup your system environment in anticipation of potential adverse circumstances.
Note: the names of target environments is implementation-dependent. The methods used to launch commands and receive command completion codes is implementation-dependent. Furthermore, the method used to determine that a command completed in ERROR or FAILURE is implementation-dependent. Some implementations consider a negative RC as a failure completion, and a positive RC as an error completion.
Different operating systems have different commands. You should not expect the commands issued by Rexx programs to operate correctly for different systems.
Warning: when a command is issued the current command processing environment may be unknown; especially when the command is issued in a called procedure. In a procedure, you can alter the current environment by using the address built-in function, without affecting the environment(s) that have been established by the calling procedure.
You can test that the current environment is the expected environment by using the address built-in function. For example:
if address() = 'DOS' then 'dir *.rex >rexxprog.lst' else do say 'Sorry, the current command environment is not DOS, exiting...' exit 99 end
Hint: you can deliver a command to an explicit environment by using the address instruction instruction as follows:
address DOS 'dir *.rex >rexxprog.lst'