1. Close your Department Maintenance form and switch to the Visual LANSA editor. Add a BEGIN_LOOP/END_LOOP at the beginning of the UPDATE.Click event handling routine.
The loop should be performed 10 times using STD_COUNT as the loop count and display a message 'Message number is nn' containing STD_COUNT. Your code should look like the following:
Begin_Loop Using(#STD_COUNT) To(10)
Message Msgtxt('Message number is ' + #std_count.asstring)
Update Fields(#FORMDATA) In_File(DEPTAB) Val_Error(*NEXT)
. . . . .
This provides a line of code that executes a number of times, each time the UPDATE.Click event routine runs.
2. Compile your form.
3. Run the form in debug using the toolbar button:
When the program stops at the Create_Instance routine, scroll down to the UPDATE.Click event handling routine and clear the breakpoint on the UPDATE statement.
There are a number of ways you can do this. For example:
a. Select this line of code and press F9 or use the Toggle Breakpoint button on the Debug ribbon.
b. Select this line of code and use the right mouse menu option, Remove Breakpoint.
c. Display the Breakpoints tab, select this breakpoint and use the Remove Breakpoint toolbar button.
4. Select the MESSAGE command inside the loop and press F9 to set this as a breakpoint.
5. Use the right mouse menu option while selecting the MESSAGE command to show the Breakpoint Properties dialog.
6. Set a Pass count of 3. In debug mode, during an update, the loop will now execute twice and break on every third execution of the MESSAGE command.
7. Execute the form in debug mode, Fetch a department and press the Update button. Debug will initially break on the MESSAGE command on the 3rd execution. Press F5 and the break will then occur on the 6th execution. Press F5 again to break on the 9th execution. Press F5 again and the Update routine will run and perform the table update.
8. Close your form.
9. Remove the breakpoint from the MESSAGE command.