You can use variables to build commands. The SHOFIL.CMD program is an example. SHOFIL types a file that the user specifies. It prompts the user to enter a file name and then builds a variable containing the TYPE command and the input file name.
To have Rexx issue the command to the operating system, put the variable containing the command string on a line by itself. Rexx evaluates the variable and passes the resultant string to Windows:
/* SHOFIL.CMD - build command with variables */
/* prompt the user for a file name */
say "Type a file name:"
/* assign the response to variable FILENAME */
pull filename
/* build a command string by concatenation */
commandstr = "TYPE" filename
/* Assuming the user typed "demo.txt," */
/* the variable COMMANDSTR contains */
/* the string "TYPE DEMO.TXT" and so... */
commandstr /* ...Rexx passes the */
/* string on to Windows */Rexx displays the following on the screen when you run the program:
[C:\]rexx shofil Type a file name: demo.txt This is a sample text file. Its sole purpose is to demonstrate how commands can be issued from Rexx programs. [C:\]