Issuing a Command to Call a .CMD File

If you issue a command to have the system run one of its built-in commands or other programs, you can call it by name. However, to run another .CMD program from your Rexx program, you must call it using a CALL instruction instead of its name. You can use the Rexx CALL instruction or the Windows CALL command.

The Rexx CALL instruction calls other Rexx programs. To call a Rexx program named MYSUB1, your CALL instruction could look like this:

call mysub1

Rexx recognizes the CALL instruction, handles the call, and processes MYSUB1 as a Rexx program.

The Rexx CALL instruction does not call a non-Rexx .CMD file. Instead, you would use the Windows CALL command. To call a non-Rexx .CMD program named MYSUB2, you could write the CALL instruction like this:

"call mysub2"

Rexx evaluates the expression and passes it to the Windows command handler for processing. The command handler recognizes the CALL command and processes MYSUB2 as a .CMD program.

The quotation marks around call mysub2 indicate that this is the Windows CALL command instead of a Rexx CALL instruction.

You can also execute another Rexx program within a new process by invoking the interpreter followed by the Rexx program name like this:

"rexx mysub2"

However, remember that running the interpreter concurrently requires additional startup time and system resources.