| REINPUT  | [ FULL] 
                           																[(statement-parameters)] | 
 | USING HELP | 
 | 
| WITH-TEXT-option | ||||
| [MARK-option] | ||||
| [ALARM-option] | 
This document covers the following topics:
For explanations of the symbols used in the syntax diagram, see Syntax Symbols.
Related Statements: DEFINE
                        								WINDOW | INPUT | SET WINDOW
Belongs to Function Group: Screen Generation for Interactive Processing
The REINPUT statement is used to return to and
                  										re-execute an INPUT
                  										statement. It is generally used to display a message indicating that the data
                  										input as a result of the previous INPUT statement were invalid.
                  										See Example
                     										1.
               
No WRITE or
                  										DISPLAY statements may be
                  										executed between an INPUT statement and its corresponding
                  										REINPUT statement. The REINPUT statement is not valid
                  										in batch mode.
               
The REINPUT statement, when executed, repositions the
                  										program status regarding subroutine, special condition and loop processing as
                  										it existed when the INPUT statement was executed (as long as the
                  										status of the INPUT statement is still active). If the loop was
                  										initiated after the execution of the INPUT statement and the
                  										REINPUT statement is within this loop, the loop will be
                  										discontinued and then restarted after the INPUT statement has been
                  										reprocessed as a result of REINPUT.
               
If a hierarchy of subroutines was invoked after the execution of the
                  										INPUT statement, and the REINPUT is performed within
                  										a subroutine, Natural will trace back all subroutines automatically and
                  										reposition the program status to that of the INPUT statement.
               
It is not possible, however, to have an INPUT statement
                  										positioned within a loop, a subroutine or a special condition block, and then
                  										execute the REINPUT statement when the status under which the
                  										INPUT statement was executed has already been terminated. An error
                  										message will be produced and program execution terminated when this error
                  										condition is detected.
               
Note:
The execution of a REINPUT statement (without
                     												FULL option) does not reset the MODIFIED status of an
                     												attribute control variable used in the corresponding INPUT
                     												statement. To check if an attribute control variable has been assigned the
                     												status MODIFIED, use the
                     												MODIFIED
                     												option.
                  
| Syntax Element | Description | |
|---|---|---|
| REINPUT FULL | FULL Option: If you specify the  
 Note: Another characteristic of the  | |
| statement-parameters | Parameters: Parameters specified in a  Any parameter specified at element (field) level (see MARK Option) will override any corresponding parameter at statement level. | |
| Parameters that can be specified with the REINPUTstatement: | Specification (S = at statement level, E = at element level) | |
| AD- Attribute
                           																		Definition * | SE | |
| CD- Color
                           																		Definition | S | |
| * If  The individual session parameters are described in the Parameter Reference. | ||
| USING HELP | USING HELP Option: This option causes the helproutine defined for the
                              																				 
 Example: REINPUT USING HELP MARK 3 As a result, the helproutine defined for the third field
                              																				in the  | |
| WITH-TEXT-option | WITH TEXT Option: The  See WITH TEXT Option. | |
| MARK-option | MARK Option With the  | |
| ALARM-option | ALARM Option: This option causes the sound alarm feature of the terminal
                              																				to be activated when the  See ALARM Option. | |
WITH TEXT is used to provide text which is to be
                  												displayed in the message line. This is usually a message indicating what action
                  												should be taken to process the screen or to correct an error.
               
| [ WITH]
                           																				[TEXT] | 
 | 
 | [(attributes)]
                           																				[,operand3]  7 | 
Operand Definition Table:
| Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| operand1 | C | S | N | P | I | B * | yes | no | ||||||||||||
| operand2 | C | S | A | U | yes | no | ||||||||||||||
| operand3 | C | S | A | U | N | P | I | F | B | D | T | L | yes | no | ||||||
* Format B of
                  												operand1 may be used only with a length
                  												of less than or equal to 4.
               
Syntax Element Description:
| Syntax Element | Description | 
|---|---|
| operand1 |  Message Text from Natural Message File:
                                 																						   You can retrieve either user-defined messages or Natural system messages: 
 See also Example 4 - WITH TEXT Options.Natural message files are created and maintained with the SYSERRutility as described in the
                           																				relevant documentation. | 
| operand2 |  Message Text:    See also Example 4 - WITH TEXT Options. | 
| attributes | Output Attributes: It is possible to assign various output attributes for
                              																						 | 
| operand3 |  Dynamic Replacement of Message Text:
                                 																						   The values provided are used to replace parts of a
                              																						message text that are either specified with  The notation  See also Example 4 - WITH TEXT Options. Note: Leading zeros or trailing blanks will be removed from the field value before it is displayed in a message. | 
attributes indicates the output attributes to be used for text display. Attributes may be:
| 
 |  
                              																								 | 
 | |
| 
 | 
For the possible session parameter values, refer to the corresponding sections in the Parameter Reference documentation:
Note:
 The compiler actually accepts more than one attribute value
                     														for an output field. For example, you may specify: AD=BDI. In such
                     														a case, however, only the last value applies. In the given example, only the
                     														value I will become effective and the output field will be
                     														displayed intensified.
                  
With the MARK option, you can mark a specific field,
                  												that is, specify a field in which the cursor is to be placed when the
                  												REINPUT statement is executed. You can also mark a specific
                  												position within a field. Moreover, you can make fields input-protected, and
                  												change their display and color attributes.
               
| MARK[POSITIONoperand4  [IN]] [FIELD] | 
 | 
 | 
 | [(attributes)] | 
 | ||
| 
 | 
Operand Definition Table:
| Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| operand4 | C | S | N | P | I | yes | no | |||||||||||||
| operand5 | C | S | A | N | P | I | yes | no | ||||||||||||
Syntax Element Description:
| Syntax Element | Description | 
|---|---|
|  Field to be Marked:  All  The  If the corresponding  INPUT #ARRAY (A1/1:5) ... REINPUT (AD=P) 'TEXT' MARK *#ARRAY (2:3) If  RESET #X(N2/1:2) INPUT #ARRAY ... ... REINPUT (AD=P) 'TEXT' MARK #X (1:2) | |
| MARK
                              																				POSITION | MARK POSITION Option: With this option, you can have the cursor placed at a
                              																						specific position - as specified with
                              																						 | 
| operand4 | Cursor Position: 
 
 | 
| attributes | Attribute Assignments: | 
With explicit attributes, you can define the display presentation
                  												and color of the WITH TEXT message and also the layout of the
                  												MARK field (which is positioned by the REINPUT
                  												statement).
               
| 
 | 
 | B | 
 | 
 | 
 | 
 | BL | 
 | 
 | ||||
| C | GR | ||||||||||||
| D | NE | ||||||||||||
| AD=[P] | 
                              																				I | CD= | PI | [ CV=operand6] | |||||||||
| N | RE | ||||||||||||
| U | TU | ||||||||||||
| V | YE | 
Operand Definition Table:
| Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| operand6 | S | C | no | no | ||||||||||||||||
With the attribute AD=P, you can make an input
                  												field (AD=A or AD=M) input-protected. 
               
Note:
You cannot use an attribute to make output-only fields
                     												(AD=O) available for input.
                  
For information on the attributes
                  												AD,
                  												CD and
                  												CV, refer
                  												to the Parameter Reference.
               
The attributes
                  												for the WITH TEXT and MARK fields need not be
                  												specified in a fixed manner, but can also be assigned dynamically by means of a
                  												control variable, which is referenced in a
                  												(CV=operand6) clause.
                  												See Example 5 - REINPUT
                     												with Attribute Assignment Using a Control Variable.
               
If both an AD and a
                  												CV option are specified for the same field, the
                  												attributes from the AD option are completely ignored,
                  												except (AD=P) which remains in effect.
               
If a CD and a CV
                  												option are specified for the same field, the color from the
                  												CV option is used. If the CV
                  												variable contains no color specification, the color from the
                  												CD option is applied to that field.
               
If AD=P is specified at statement level, all fields
                  												except those specified in the MARK option are
                  												input-protected. See also Example 2 - REINPUT with Attribute
                     												Assignment.
               
| [ AND] [SOUND]ALARM | 
This option causes the sound alarm feature of the terminal to be
                  												activated when the REINPUT statement is executed. The appropriate
                  												hardware must be available to be able to use this feature.
               
** Example 'REIEX1': REINPUT                                            
************************************************************************
DEFINE DATA LOCAL                                                       
1 #FUNCTION (A1)                                                        
1 #PARM     (A1)                                                        
END-DEFINE                                                              
*                                                                       
INPUT #FUNCTION #PARM                                                   
*                                                                       
DECIDE FOR FIRST CONDITION                                              
  WHEN #FUNCTION = 'A' AND #PARM = 'X'                                  
    REINPUT 'Function A with parameter X selected.'                     
            MARK *#PARM                                                 
  WHEN #FUNCTION = 'C' THRU 'D'                                         
    REINPUT 'Function C or D selected.'                                 
  WHEN #FUNCTION = 'X'                                                  
    STOP                                                                
  WHEN NONE                                                                 
    REINPUT 'Please enter a valid function.'                            
            MARK *#FUNCTION
END-DECIDE                 
*                          
END 
               										#FUNCTION A #PARM Y
PLEASE ENTER A VALID FUNCTION #FUNCTION A #PARM Y
** Example 'REIEX2': REINPUT  (with attributes)                         
************************************************************************
DEFINE DATA LOCAL                                                       
1 #A (A20)                                                              
1 #B (N7.2)                                                             
1 #C (A5)                                                               
1 #D (N3)                                                               
END-DEFINE                                                              
*                                                                       
INPUT (AD=A) #A  #B  #C  #D                                             
*                                                                       
IF #A = ' ' OR #B = 0                                                   
  REINPUT (AD=P) 'RETYPE VALUES'                                        
                 MARK *#A (AD=I CD=RE)    /* put cursor on first field  
                      *#B (AD=U CD=PI)    /* and change colors    
END-IF                                                                  
*                                                                       
END 
               								 
               								
               ** Example 'REIEX3': REINPUT (with FULL and POSITION option) ************************************************************************ DEFINE DATA LOCAL 1 #A (A20) 1 #B (N7.2) 1 #C (A5) 1 #D (N3) END-DEFINE * INPUT (AD=M) #A #B #C #D * IF #A = ' ' COMPUTE #B = #B + #D RESET #D END-IF * IF #A = SCAN 'TEST' OR = ' ' REINPUT FULL 'RETYPE VALUES' MARK POSITION 5 IN *#A END-IF * END
RETYPE VALUES #A #B 0.00 #C #D 0
** Example 'REIEX4': REINPUT (with TEXT option) ************************************************************************ DEFINE DATA LOCAL 01 #NAME (A8) 01 #TEXT (A20) END-DEFINE * * INPUT WITH TEXT 'Enter a program name.' 'Program name:' #NAME * IF #NAME = ' ' REINPUT WITH TEXT 'Input missing. Enter a name.' END-IF * IF #NAME NE MASK (A) MOVE 'Invalid input.' TO #TEXT REINPUT WITH TEXT ':1: Name must start with a letter.',#TEXT ELSE /* Using Natural error message 7600 for demonstration COMPRESS *INIT-USER 'on' *DAT4I INTO #TEXT INPUT WITH TEXT *-7600,#NAME,#TEXT 'Input accepted.' END-IF END
DEFINE DATA LOCAL
1 #HELLO (A5)  INIT <'HELO'>
1 #VAR   (A20) INIT <'Enter "HELLO"'>
1 #CV (C)
END-DEFINE
*
INPUT (IP=OFF) #HELLO (AD=M)
*
IF #HELLO NE 'HELLO' THEN
  MOVE (AD=U CD=RE) TO #CV
  REINPUT FULL WITH TEXT #VAR (CD=YE)
               MARK *#HELLO   (CV=#CV)
END-IF
END