Issuing a Command to Call a .CMD File

If you are issuing a command to have OS/2 run one of its built-in commands or other programs, you can call it by name as previous examples showed. However, to have OS/2 run another .CMD program from your REXX program, you must call it using a CALL instruction instead of calling it by name. There are two kinds of calls you can use:

The REXX CALL instruction calls other REXX programs. To call a REXX program named MYSUB1, you could write the CALL instruction:

call mysub1

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

The REXX CALL instruction does not work to call a non-REXX .CMD file. Instead, you would use the OS/2 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 OS/2 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 OS/2 CALL command instead of a REXX CALL instruction.


[Back: REXX and Batch Files]
[Next: Using Variables to Build Commands]