Getting Started with TRANSACT (32247-90007)
Chapter 5 85
Automatic Error Handling and Prototyping
In order to find out what key was pressed by the user, line 9 was modified by adding an
option to tell Transact where to put this information and lines 1.1 to 1.4 were added to
define the variable lastkey.
As a side note, the variable enter was set up to improve program readability when
checking if [[ENTER]] was pressed.
What happens if we enter some invalid data using this prototype? Transact's automatic
error handling takes over and redisplays the screen, while asking for new input. It also
attempts to let us know what caused the error. For example, cust-no is a numeric field. If
non-numeric data is entered, Transact displays an error message in the VPLUS window,
pauses for a few seconds to give us the opportunity to read the message, and then
redisplays the screen that was in error for us to enter data again. The following screen
illustrates that process.
Figure 5-4. Automatic Error Handling with VPLUS
Things are more complicated if an error occurs on form vorderline because it is displayed
using the APPEND option. After Transact displays the error message, the new form for
data entry is appended to the last form. Thus the line in error remains on the screen and a
new empty form for correcting the error is added to the screen. The two example screens
below illustrate this point.
Figure 5-5. Automatic Error Handling with VPLUS Append
vorderhead order data
order number [123 ] customer [CUST1] status [0 ] date [850101]|
*ERROR: ENTRY NOT NUMERIC (USER 1,10)
vorderhead order data
order number [123 ] customer [1 ] status [0 ] date [850101]|
line number [1 ] part-number [PART1 ] quantity [10 ]
*ERROR:THERE IS NO CHAIN HEAD (MASTER ENTRY) FOR PATH 2 (IMAGE 102,32,ORDERLIN