Reinput while using MAP and WINDOW.

Hi,

I have a reporting program in which a map is displayed and then all the values displayed are validated and error message is taken care of using a Reinput statement.

The program looks something like this:-
Repeat
MAP (AD=parameters)
01/01 … all the fields are displayed

  • after the entire map is displayed, individual fields are validated.
  • Field validations and if any error in validation then
    REINPUT Text MARK FIELD field-number ALARM
    Loop

I am trying to add a new validation to the program. For this i am creating a new window using the DEFINE WINDOW statement. Then i am displaying the window using INPUT WINDOW statement.
The window is displayed properly but after the new window statments are processed, all the reinput statements which earlier pointed to a map result in an error ‘REINPUT statement not preceded by INPUT statement’.
Any way i can resolve this and get the reinputs to point to the map and not the window?

Any help is greatly appreciated!

Ron.

We need to see your code really by why don’t you use the same style REINPUT as all the other validation ?
I think your input in the window has caused the problem as that INPUT is no longer active.

If the original INPUT is in a loop you could try to STACK TOP DATA ’ ’ and re-execute the loop but I would drop the window processing

Let me guess; you are WRITEing or DISPLAY’ing inside the window. Correct?

This destroys the buffer area where the Map was; so, REINPUT does not have a Map to transfer control to; the Map is GONE.

You need to have someone, who really understands windowing, explain it to you.

I am very familiar with this error. If you want to give more than a one line message on an error, you cannot use REINPUT. For this reason, we abandoned the statement years ago, though it still appears in older code.

Our current solution looks something like this:


REPEAT
   INPUT WITH TEXT #MSG MARK #CURSOR USING MAP 'OURMAP'
   RESET #MSG #CURSOR

   PERFORM CHECK-PF-KEYS
   IF #ESCAPE
      ESCAPE BOTTOM
   END-IF

   PERFORM AUDIT-MAP-FIELDS
   IF #MSG NE ' '
      ESCAPE TOP
   END-IF

   ESCAPE BOTTOM
END-REPEAT

Within AUDIT-MAP-FIELDS we might just set #MSG for an error, or we might have a “pop-up” window that gives more information or asks for more input, like a confirmation of the update.

@Giles Unfortunately i cant share the actual code.
I am using the window since i need some additional response from the user before proceeding. I cant add that field on the existing screen. I understood that the window i used caused the original MAP to be no longer active. The original input is in a loop, i will try using STACK command and see how it goes.

@Steve
I havent used WRITE or DISPLAY commands. I have used it like this-
INPUT WINDOW=WINDOW-NAME
/ ‘TEXT HERE
/ ‘* TEXT HERE*’ variable.

I will be really happy if you could point me to some document which explains windowing, the guy who used to be really good at this is now retired and we dont have anyone else.

place your new INPUT in the WINDOW after all the other validation.

Also try entering “? 1108” on the command line or any other error message for that matter for more info.
and try to get hold of a manual :lol:

@Jerome
That would be the ideal way to do it but I cant change all the code to implement this change. And we have a lot of reinputs.

@Giles
That’s what i have done right now, placed the window at the bottom of the validation, just before the original input loop ends. But the problem with that is when the i go back from the popup window, i cant print any error message on the mainscreen. This felt like a very awkward solution to me so i am a bit worried about this thing having some side effects. So i am trying to find out the right way to do this.

Thanks for the “?” tip. I do have the manual :smiley:

This is why we have helproutines; and, REINPUT USING HELP.

Here is a program:

define data local
1 #a (a3)
1 #b (a5)
end-define
*
input ‘enter #a here==>’ #a (ad=m)
/// ‘enter #b here ==>’ #b (ad=m he=‘hforb2’)
if #b = ‘xxx’
reinput using help mark field *#b
end-if
if #a = ‘aaa’
reinput ‘bad value for #a, try again’ mark field *#a
end-if
write ‘=’ #a ‘=’ #b
end

and here is the helproutine hforb2:

define data parameter
1 #b (a5)
end-define
input ‘you entered’ #b (ad=o) ‘for #b
/ ‘this is not a valid value’
/’ please enter another here==>’ #b
end

You can have as many lines of help as you need.

Giles, this would also address your “standard” use of an INPUT statement inside of a dummy REPEAT loop

1 Like

You could you the [WITH-TEXT-option] on the main INPUT statement.
Reset this value after the INPUT.

loop
INPUT fields WITH TEXT #MESSAGE
reset #MESSAGE
validation…
your window processing
MOVE 'some message" to #MESSAGE
endloop

@Steve
The solution you provided works nicely.

Thanks for making me a bit wiser :D.

@Ron P Glad it works for you.

@Giles With REINPUT FULL you can change the content of any variables you want on a Map. You could have a “message area” to the bottom of a screen with say, four lines that are blank; make them AD=O. Move “stuff” to them, then do a REINPUT FULL, the “stuff” (presumably error messages) will be visible.

Another suggestion. Suppose you have an INPUT with variables like #1 #2 #3 etc. Assuming you have space on your screen, define variables like #under1 #under2 etc. Put them underneath, and the same number of characters, the corresponding #1, #2, etc. If there is an error in #2, MOVE ALL ‘?’ TO #under2.

You could even make the ? a color via the MARK option REINPUT ‘…’ MARK FIELD *under2 (CD=PI); you could also have something like AD=VB (assuming your terminals support blinking and reverse video)

REINPUT added quite a number of features (I believe in V4, but it may have been as early as 2.2), like protecting and unprotecting fields, putting the cursor within a field (position), etc. Also, you can , of course MARK multiple fields.

If someone knows of something you can do with the dummy REPEAT loop that you cannot do with the REINPUT statement, please post it here.

Ron is the one asking for help Steve, not me :wink: