Error NAT1108?

Hi all,

I am getting the following error in one of my program:

NAT1108 REINPUT statement not preceded by INPUT statement

A small part of the code is given below–>

WRITE ‘ENTER THE NAME’
INPUT #NAME
PERFORM INSUBRTRR8
WRITE ‘THE CITY IS’#CITY
RESET #NAME
WRITE ‘ENTER ANOTHER NAME’
REINPUT #NAME

Can anyone clarify why it is giving this error?

Rahul

Explanation of error:

When a REINPUT statement is to be executed, the last communication
with the screen must have been via an INPUT statement.
REINPUT is not permitted for a screen that was produced by a WRITE
or DISPLAY statement.
Neither is REINPUT permitted for an INPUT statement inside a loop,
subroutine or special condition block, when the loop, subroutine or
special condition block has already been terminated.
e.g.: REPEAT
INPUT …
ESCAPE
LOOP
REINPUT will produce this error because at execution of the
REINPUT statement the loop which contains the respective
INPUT statement has already been closed.

If you remove the write statements before REINPUT then it will work. if we use WRITE/display with REINPUT then we get this error. if possible move write statment in separate subroutine after input/reinput processing completed to check the values entered.

Between INPUT and REINPUT no WRITEs are allowed.

Please try the following code instead:

REPEAT
  INPUT 'ENTER THE NAME' #NAME /
    'THE CITY IS   ' #CITY (AD=O) /
    'PF12 to CANCEL'
  PERFORM INSUBRTRR8
  RESET #NAME
  IF *PF-KEY = 'PF12'
    ESCAPE BOTTOM
  END-IF
END-REPEAT