The INPUT command is how you obtain input from a user. It allows you to ask the user a question and put his response into a dummy variable so you can test that answer (variable) against various criteria and thereby take some specified action.
Syntax:
input dv "message/question."
The dummy variable used does not matter. It will be cleared of whatever value it had and filled with whatever the user types to answer the question/message.
Often, it is valuable to limit the response from the user to only certain values. You can do this most easily by giving the dummy variable a specific edit type. You can do this right on the INPUT line, as in:
input qq(1,yesno) "Does everything look okay?"
This assigns a length of 1 to the variable qq and it assigns the edit type of yesno. This is a factory provided edit type that only allows a Y or an N as an answer (or the user may press ENTER). If the user presses a "B" or a "J" or any other key other than a Y or an N (or ENTER) the program will just sit there and wait for him to get it right. That is why it is valuable to put the suggested answers inside your INPUT message, like this:
input qq(1,yesno) "Does everything look okay? (y/n)"
In this way, you are asking the question and providing the allowable answers all in one message.
The INPUT command has just about the same set of variations as the SHOW command. You can use:
INPUT(r,c) dv message
Where r and c are the row and column at which to show the input message, and dv is the dummy variable into which to which the answer goes. There is also:
INPUT POPUP(r,c) dv "message"
And this is just like the show popup. The input message is neatly boxed (and centered if you leave row and column blank).
There is one more INPUT command, INPUTPW (and INPUTPW POPUP). These are the very same as INPUT except that they hide the users response by printing #s on the screen instead of their actual response. This is so you can ask for passwords and secret things and no one standing behind the user will see the secret. However, the correct response is still deposited in the specified input dummy variable.
Making Use of the Response
Once you have queried the user with any of the INPUT variations, you will end up with his response as the contents of the dummy variable you provided. If you issued the statement as:
input qq(1,yesno) "Do you want a hardcopy? (y/n)"
The program will now have the users response store in qq. You may do something like:
If: qq ne "Y"
Then: end
If:
Then: hardcopy ; end
This says in English: If the users answer was not equal to a "Y" then he must not want a hardcopy, just end the processing here. Otherwise, if the user had answered a "Y", the first test would be false and the then line would not be done. Instead, the program falls through to the next "if" line and tests it. Since there is nothing to test, the program assumes that it should execute the "then" line. This is true anytime there is no "if" test, the "then" line will be executed.
You can use the same INPUT variable over and over again. In other words, you do not need to assign a different INPUT variable each time you ask a "yesno" question. If you have used qq once before, you can use it again. It gets cleared just before it is put on the screen so you will be testing the newly offered input from the user each time. If you need a different type of input, say a date, then you would need to establish a date type INPUT variable (which you could use for every date question from then on in that processing table.)