The PULL instruction can be used to get input from the person running the script, and store that input data in a variable. After the PULL keyword, you supply the name of the variable where you want the data.

The script stops executing at that point and waits for the user to type in some text (within a command prompt window). When the user presses the ENTER key, that line of text is stored in the desired variable, and the script resumes executing after the PULL instruction. (PULL therefore retrieves only one line of text at a time).

Here we get some input from the user, store it in the variable named My_Variable, and then echo whatever the user typed back to the screen.

PULL My_Variable
SAY My_Variable
Note: If the user presses the ENTER key without typing any other characters before it, then the string returned is an empty string. That is to say that My_Variable will be set to "".

If you wish to display a message to the user telling him what to do, you'll use a SAY instruction (or other instruction that prints to the screen) to print that message before the PULL instruction. Here we tell the user to type in his name.

/* This script asks the user to type his name, and echoes it */
SAY "Enter your name"
PULL My_Variable
SAY My_Variable
When running the above script, you'll note that the PULL instruction converts all letters to upper case. If you wish to retain the case as typed by the user, use PARSE PULL instead.
PARSE PULL My_Variable
For more information about PARSE PULL, see Parsing and PULL.

Note: If you're using REXX Dialog to create a graphical user interface, then you should never use PULL. Instead, use RXCREATE() to create a window with an ENTRY control (and perhaps a TEXT control to provide directions), and then use PARSE VAR to parse the value that the user types into the ENTRY, as discussed in Getting input with REXX Dialog.


Arguments passed to your script

To get arguments that were passed to your script by the user (when he ran the program), you could use either the ARG function, or the PARSE ARG statement.

The following script should print out the arguments you type (at the command line, or in Reginald's Script Launcher "Args" box). For example, if you type:

argument 1, argument 2, argument 3
Then it should display:
Argument  1 = "argument 1"
Argument  2 = "argument 2"
Argument  3 = "argument 3"
/* A script to check arguments passed to it */
numargs = ARG()
SAY 'There are' numargs 'arguments passed to this script.'
DO i = 1 to numargs
   SAY 'Argument ' i '= "' || ARG(i) || '"'
END
EXIT
Alternately, you could use the PARSE ARG statement. That in itself won't tell you how many arguments you have (ie, ARG() will still do that), but it does allow you to parse for matching patterns all in one statement. And if you already know how many arguments you expect, then you don't need ARG(). (Personally I prefer to use ARG() to retrieve that arguments into variables, and then use separate PARSE VAR statements to break them apart if need be).
PARSE ARG arg.1, arg.2, arg.3, .
DO i = 1 to 3
   SAY 'Argument ' i '= "' || arg.i || '"'
END
EXIT