%INPUT Statement

Supplies values to macro variables during macro execution.
Type: Macro statement
Restriction: Allowed in macro definitions or open code
See: %PUT Statement%WINDOW Statement and SYSBUFFR Automatic Macro Variable

Syntax

%INPUT<macro-variable-1 <...macro-variable-n>> ;

Required Arguments

no argument
specifies that all text entered is assigned to the automatic macro variable SYSBUFFR.
macro-variable-1 <...macro-variable-n>
is the name of a macro variable or a macro text expression that produces a macro variable name. The %INPUT statement can contain any number of variable names separated by blanks.

Details

The macro processor interprets the line submitted immediately after a %INPUT statement as the response to the %INPUT statement. That line can be part of an interactive line mode session, or it can be submitted from within the Program Editor window during a windowing environment session.
When a %INPUT statement executes as part of an interactive line mode session, the macro processor waits for you to enter a line containing values. In a windowing environment session, the macro processor does NOT wait for you to input values. Instead, it simply reads the next line that is processed in the program and attempts to assign variable values. Likewise, if you invoke a macro containing a %INPUT statement in open code as part of a longer program in a windowing environment, the macro processor reads the next line in the program that follows the macro invocation. When you submit a %INPUT statement in open code from a windowing environment, ensure that the line that follows a %INPUT statement or a macro invocation that includes a %INPUT statement contains the values that you want to assign.
When you name variables in the %INPUT statement, the macro processor matches the variables with the values in your response based on their positions. That is, the first value that you enter is assigned to the first variable named in the %INPUT statement, the second value is assigned to the second variable, and so on.
Each value to be assigned to a particular variable must be a single word or a string enclosed in quotation marks. To separate values, use blanks. After all values have been matched with macro variable names, excess text becomes the value of the automatic macro variable SYSBUFFR.

Example: Assigning a Response to a Macro Variable

In an interactive line mode session, the following statements display a prompt and assign the response to the macro variable FIRST:
%put Enter your first name:;
%input first;