Step 6 Set a Break on Value

Visual LANSA

Step 6. Set a Break on Value

FRM045 - Using LANSA Debug

In this step you are going to again use the UPDATE.Click event routine and set a breakpoint on the first IF_STATUS command, with a break on value setting for variable IO$STS. This is a 2 character I/O status, returned by the UPDATE command. When a validation error occurs it will contain 'VE'.

1.  Switch to the editor and review the definition of the UPDATE command in the UPDATE.Click event routine. If it looks like the following:

Update Fields(#FORMDATA) In_File(DEPTAB)
 

     Then because the VAL_ERROR parameter for the FETCH command, has a default value of *LASTDIS, which in a form means branch to the end of the routine, the IF_STATUS which follows it is never executed when a validation error occurs. Ensure your update command looks like the following:

Update Fields(#FORMDATA) In_File(DEPTAB) Val_Error(*NEXT)

     Recompile your form if you needed to make a change.

2.  Set a breakpoint on the first IF_STATUS command.

3.  Run the form in debug. When the editor is displayed at the Initialize routine, scroll down to the UPDATE.Click event routine and set a break point on the first IF_STATUS command.

4.  In the variables tab, select the IO$STS variable and use the right mouse menu to Break on Value Condition

5.  In the Breakpoint Properties dialog, select the Value tab and set the breakpoint to break when IO$STS is equal to 'VE'

6.  Select OK and press F5 to run the form.

7.  Fetch a department and press Update. Debug should not break because IO$STS is not equal 'VE'

8.  Fetch a department and clear the department description field and press Update. Debug should now break on the IF_STATUS command.

9.  Close your form and close it in the editor. You have completed this exercise.