When you type in the following program, use the REXX/CICS editor for files that reside in the REXX File System (RFS).
The name of the program is HELLO EXEC (for now, assume that the file type is exec).
edit hello.exec
====> file
Now your program is ready to run.
/* REXX HELLO EXEC */
/* A conversation */
say "Hello! What is your name?"
pull who
if who = "" then say "Hello stranger!"
else say "Hello" who
Clear the screen before running an exec. If you want to run a program that has a file type of EXEC, you type in REXX followed by its file name. In this case, type rexx hello on the command line and press Enter. Try it!
Suppose your name is Sam. Type sam and press Enter. Hello SAM is displayed.
rexx hello
Hello! What is your name?
sam
Hello SAM
Here is what happens:
who = ""
This
means, "is the value stored in who equal to nothing?" To
find out, REXX substitutes that stored value for the variable name.
So the question now is: Is SAM equal to nothing?
"SAM" = ""
Hello SAM
Now, here is what happens if you press Enter without typing a response first.
hello
Hello! What is your name?
Hello stranger!
Then again, maybe you did not understand that you had to type in your name. (Perhaps the program should make your part clearer.) Anyhow, if you just press Enter instead of typing a name:
who = ""
meaning:
Is the value of who equal to nothing? When the value of who is
substituted, this scans as:
"" = ""
And this time,
it is true.