Getting Started with TRANSACT (32247-90007)

174 Chapter9
Creating Custom Applications
User Exits
The program sets up a marker element which it uses to denote the point in the list register
that the subprogram has access to (line 27 and 48).
The form is displayed without erasing the information, if the user exit program detected
an error. Otherwise an initialized form is displayed. Lines 34 to 45 handle this.
Lines 46 to 48 implement the user exit by searching for a match on form name in the
cross-reference file. This code and file could be expanded to provide for multiple user exits
during the same transaction and to make a user exit optional.
The user exit program follows. The user has decided to add a password to the customer
update menu and has added the logic to his subprogram to validate the password.
Figure 9-29. User Exit Subprogram for Data Validation
Note that the user exit program must contain the LIST definition corresponding to the
main program definition that occurs after the marker item. Standardized procedures for
communicating error conditions, etc. must also exist.
The modified user version of the form custupdatemm and the dictionary description of this
form follows:
1 system cu1,vpls=formfile;
2 list(auto) custupd-global;
3 list(auto) customer;
4 let (error) = (no);
5 if (password) <> "OKAY"
6 then
7 do
8 set(form) *,window=(password,"invalid password");
9 let (error) = (yes);
10 doend;
11 exit;