Problem while using two windows

Hi All

There is map in which i had used a window for displaying some info if a particular field in the map is incorrect or blank.I had used the same window multiple times for various fields.

now the problem which i am facing is when i run the map and suppose the first window is displayed due to some field is blank in the main map.then when i press enter the another window appears (this shud happen,so its ok…as another field in the map is left blank).But when the second window appears the orignal map loses its logical definition

Can anyone tell me why is his happening ?

please tell me if you guys require any more information.

"But when the second window appears the orignal map loses its logical definition "

What does the above mean? The original map disappears?

steve

Actually i can’t post the screendumps here…even if do post it here with masking it will be very difficult to understand the situation even then.

for now i can explain it in other way…
the map doesn’t look like in the same way when second window is displayed…as it was in originally displayed in the first screen.the heading information is totally gone with couple of more rows in top.Exactly 6-7 lines from top of the screen.

Can i do the same thing using the INPUT statement ?

As while using Input statement as well,i am facing similar kind of problem.

i have tried to code using INPUT in the following way.

If field-a eq ’ ’
SET CONTROL ‘N’
INPUT USING MAP ‘map12345’
SET CONTROL ‘WL45C13B7/34F’
INPUT (IP=OFF)
005T ‘WARNING!’
//005T ‘xxxxxxxxxxxxxxxxxxx’
/005T ‘---------------------’
/005T ‘xxxxxxxxxxxxxxxxxxxxxxxx’
/005T ‘xxxxxxxxxxxxxxxx’
/005T ‘xxxxxxxxxxxxxxxxxxx’
IF *PF-KEY NE ‘ENTR’
REINPUT ‘INVALID COMMAND’
ELSE
set control ‘wb’
end-if
*

if field-b eq ’ ’
SET CONTROL ‘N’
INPUT USING MAP ‘map12345’
SET CONTROL ‘WL45C13B7/34F’
INPUT (IP=OFF)
005T ‘WARNING!’
//005T ‘yyyyyyyyyyyyyyyyy’
/005T ‘-----------------’
/005T ‘yyyyyyyyyyyyyyyyyyyyyyyyyyy,’
/005T ‘yyyyyyyyyyyyyyyyyyyyyyyy?’
//005T 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy ’
/005T ‘yyyyyyyyy’
/005T ‘yyyyyyyyyyyyyyyyyyyyyyyyy’
*
IF *PF-KEY NE ‘ENTR’
REINPUT ‘INVALID COMMAND’
ELSE
set control ‘wb’
end-if

Please ignore minor coding mistakes…and suggest can it be achieved using above input logic ?

Okay, I am guessing a bit about what you are trying to do.

Guess 1) If field-a eq ’ ’ is actually preceded by an INPUT USING MAP ‘map12345’ . Is this correct? And field-a is on the map map12345?

Guess 2) Assuming Guess 1 is correct, and assuming field-a is blank, you now proceed to do an INPUT USING MAP ‘map12345’ again. Correct so far? Then you use your %W command to create a pop up window, and use an INPUT statement to populate the window. You use the %WB command to get rid of the window.

Guess 3) assuming 1) and 2) are correct, and field-b is blank, you now want to regenerate map12345 and overlay it with the second popup window.

If these three “guesses” are correct, the coding is horrific.

There are many ways to accomplish this. I would probably use a REINPUT USING HELP with a MARK of either field-a or field-b. In the helproutine you could have an INPUT statement (if necessary for user input, and not just a text message) which will automatically disappear when control is returned to the ONE statement INPUT USING MAP ‘map12345’ in your program.

My mainframe access is temporarily not available, but when it becomes available, and if you confirm all three guesses are correct, I will write and post some code.

steve

Steve,

thanks for your promt reply.

actually consider my limitation that i have to do this by what i mentioned.As one of the input statement was already existing in the module.Instead there are 4 similar kind of input statements which pop ups while doing the validation.Now my task was to add a similar one.

so i can’t go by the option you provided,though i would really appreciate if you provide me the link for the basic fundamental about the reinput using help statement.

Can we achieve this by the way i need ?

Thanks in advance
beruoist

Hi Beruoist;

First, your last question:

"Can we achieve this by the way i need ? "

Not really. Unless you have all the code you showed us in some sort of big REPEAT loop, you will never give the user an opportunity to fix field-a or field-b (the SET CONTROL ‘N’ prevents them from accessing the fields).

Now for the far more important issue.

You said there is similar code used to create popups. The code cannot be too similar, because the code you showed will not work at all.

I am going to go on an assumption here; there is some code that works, and it does somehow involve re-issuing the map12345. This is really BAD code. What you are talking about is creating more instances of BAD code.

How did this BAD code come about? Years ago, when windowing first became available, someone probably wrote the code without really understanding INPUT, REINPUT, helproutines, REINPUT USING HELP, and windowing in general. Rather than learn about these topics, other programmers followed, basically reproducing, or slightly modifying, the BAD code. New programmer trainees saw the BAD code, appearing in many places, and assumed it was good code, so they too started writing BAD code.

Now I am not suggesting you put your job on the line. Especially in these economic times, that is not a good idea. But, you should point out to technical management how BAD this approach to windowing is. Not only is the BAD code inefficient, it does not work, and it would be messy to add on to. By contrast, good code, using a helproutine and REINPUT USING HELP (or some other variation) would be efficient, and, would be easy to add on to.

I have my mainframe access back. I hope to have time today (and if not today, tomorrow) to write good code for what I perceive you are trying to do.

steve

p.s. the most important aspect of working with Natural, or any other programming language, is Education, Education, Education. Without Education you have ignorance; which tends to result in BAD code.

Here is the program:

                                  > +  Program     WIND01   Lib XSTRO    

Top …+…1…+…2…+…3…+…4…+…5…+…6…+…7…
0010 DEFINE DATA LOCAL
0020 1 #A (A3)
0030 1 #B (A3)
0040 END-DEFINE
0050 *
0060 INPUT
0070 5T ‘1 - MAIN INPUT SCREEN FOR OUR SYSTEM’/
0080 5T ‘2 - --------------------------------’ /
0090 5T ‘3’ /
0100 5T ‘4 ENTER #A HERE==>’ #A (AD=M HE=‘WIND02’) /
0110 5T ‘5 ENTER #B HERE==>’ #B (AD=M HE=‘WIND03’) /
0120 5T ‘6’ /
0130 5T ‘7 - END OF DATA INPUT’
0140 *
0150 IF #A = ’ ’
0160 REINPUT USING HELP MARK FIELD *#A
0170 END-IF
0180 *
0190 IF #B = ’ ’
0200 REINPUT USING HELP MARK FIELD *#B
0210 END-IF
0220 *
0230 END

And here is one of the helproutines:

0010 * THIS IS A “BAREBONES” HELPROUTINE
0020 *
0030 SET CONTROL ‘WL45C13B7/34F’
0040 *
0050 INPUT
0060 5T ‘’ /
0070 5T ’
’ /
0080 5T ’
#A IS BLANK ’ /
0090 5T ’
’ /
0100 5T ’
HIT ENTER TO ’ /
0110 5T ’
RETURN TO THE ’ /
0120 5T ’
MAP TO FIX ’ /
0130 5T ’
’ /
0140 5T '

0150 END

The other mentions #B and not #A. Of course, by passing an argument to the helproutine, we could have just one helproutine instead of two

This is NOT a unique solution. There are other good solutions, as opposed to the BAD solution you were asked to “copy”.

steve