Action being performed twice

Hi All,

I have a program which does an operation of spilitting the instructions
for a record.Now when i press Enter , it spilits.If i press enter again,
it again splits.So, i get duplicate instructions if i press enter more than once by mistake.Could anyone help please.

Hi Rik,

I think you need to provide more information as I am not sure how your code looks now.

I hope your deciding your action based on *PF-KEY entered.
Check whether you are using REPEAT logic and not using ESCAPE to come out of loop.

Hi Rik;

Could you please explain the question a bit more; perhaps with an example? I am not sure if you are talking about splitting a line in the editor using the .s command, or using a .cx-y to copy lines of code, or whether you are talking about executing statements (run time).

steve

I am talking about doing an operation Through screen.My opeartion is to split a record into instructions when i press Enter.The opeartion is running fine when i press Enter but it reperforms the operation if i press another enter though i have a check to see if this operation has been done already or not.

Hi Rik;

If I am interpreting what you have said correctly, you have code something like:

                     INPUT
                     ::::
                     IF something
                         "split record"
                         END-IF

Is the INPUT statement in a REPEAT loop of some sort? Perhaps you are supposed to be ESCAPEing the loop but in actuality, are not. Since you have the ability to hit ENTER twice (can you do it more times?) it sounds like you have a REPEAT loop of some sort.

The “check” you have is clearly not working (otherwise you would not do this twice). I would look at the logic to prevent this happening more than once.

steve

Hi ,

The code is something like this.Msg-exception is being used for differentiating err msg and warning/notification. When warning , its moves true to msg exception.

Now when i get msg Press GO to update agreement.I Press go from screen , it says
operation performed successfully.Now again if i press enter here …it again asks me to Press ‘GO’ to update agreement.If i press go again here, it says operation done succesfully.
Could you please help how can i come out of this after opeartion has been performed successfully once.

My apologies , i have started using natural few days back and have received no training as of now. Any kind of help would be highly appreciated.

Also could anyone please provide me any document on how natural Online works as am not sure how program control flows after presing any attention key.

REPEAT
0655 INCLUDE lh9001C9 /* LOCATION (C1)
0660 COMPRESS #HH #II #SS INTO #UPD-TIME LEAVING NO
0665 *
0670 IF #SW-MAP = 0
0675 MOVE ‘INSTR’ TO #PFKEY-ARRAY(6)
0680 INPUT WITH TEXT +MESSAGE MARK #MARK USING MAP ‘lh0293M0’
0685 ELSE /* SEE lh0111M4
0690 * IGNORE
0695 MOVE ‘SPLIT’ TO #PFKEY-ARRAY(6)
0700 INPUT WITH TEXT +MESSAGE MARK #MARK USING MAP ‘lh0293M1’
0705 END-IF
0710 *
0715 IF *PF-KEY = ‘PF3’ OR PF-KEY = ‘PF12’
0720 PERFORM UNLOCK-HEADER
0725 END-IF
0730 *
0735 IF #MSSG-EXCEPTION
0740 RESET #MSSG-EXCEPTION +MESSAGE
0745 END-IF
0750 INCLUDE lh9003C5 /
GET FUNCTION KEYS (C1)
0755 MOVE 9 TO #MARK

main processing******

IF #RETURN-CODE = 0
1660 COMPRESS #MODE-DESC ‘PERFORMED SUCCESSFULLY’ INTO +MESSAGE
1665 MOVE TRUE TO #MSSG-EXCEPTION
1670 ELSE
1675 MOVE #MESSAGE TO +MESSAGE
1680 END-IF
1685 * RETURN CODE AND SUCCESSFUL MESSAGE & RESET-VARIABLES
1690 VALUE ‘DI’ /* SWITCH BETWEEN SPLIT AND MDI SCREEN
1695 MOVE (AD=D) TO #CV-CUST-RSD #CV-FIRM-RSD
1700 #CV-CUST #CV-FIRM #CV-REST #CV-OVERRIDE
1705 MOVE ‘SPLIT’ TO #MODE-DESC
1710 IF #SW-MAP = 0
1715 MOVE 1 TO #SW-MAP
1720 PERFORM TWO-SPLIT-INSTRUCTIONS
1725 ELSE
1730 MOVE 0 TO #SW-MAP
1735 END-IF
1740 VALUE ‘UP’ /* CANCEL SPLIT INSTRUCTION
1745 MOVE ‘Z’ TO #ACTION-TYPE
1750 MOVE ‘CANCEL’ TO #MODE-DESC
1755 PERFORM GET-OBJECTS
1760 VALUE ‘DN’
1765 MOVE ‘R’ TO #ACTION-TYPE
1770 MOVE ‘REGENERATE’ TO #MODE-DESC
1775 PERFORM GET-OBJECTS
1780 NONE
1785 IF NOT #MSSG-EXCEPTION
1790 MOVE ‘PLEASE SELECT “GO” TO UPDATE AGREEMENT’ TO +MESSAGE
1795 MOVE TRUE TO #MSSG-EXCEPTION
1800 END-IF
1805 END-DECIDE
1810 END-REPEAT

Hi Rik;

It looks like you have been dropped into the middle of a “mess”. Without any training, or without anyone at your site to “pester” for answers, you have a real problem.

If training is not forthcoming (you should ask management for this), you should at least ask to have access to people who are familiar with Natural.

steve

Thanks a ton for your reply.

Hi Rik;

One thing I noted while looking at the code. Everything you sent is in a big REPEAT loop. I do not see any ESCAPEs from the REPEAT loop. Perhaps they are in some of the code we cannot see, like the INCLUDEs or the subroutines, or the “main processing” stuff.

I would follow through the logic after you get the message “operation performed successfully”. See if you get out of the REPEAT loop.

One more thought. If you have someone in your shop who is familiar with the Natural debugger, I would try single stepping through the code following the start of the REPEAT loop.

steve

Thankyou.I found Natural Debugger.Hope it helps.