Getting Started with TRANSACT (32247-90007)
Chapter 9 173
Creating Custom Applications
User Exits
MENUNAME is the index into the program specifying the current menu or form.
USEREXIT-PROG contains the name of the Transact subprogram to be called.
As this program illustrates, there can be some data defined within the program for its own
use (lines 10 through 26). This data could also be defined in the dictionary. There can also
be global data that is of importance to both the program and the user exit program (lines
28 through 31). This data should be defined in the dictionary in order to make coding of the
user exit program easier. Included in this data are elements for handling form data input
errors (validation) and the data the user wants to add to the transaction. Finally, there is
the dataset definition needed specifically for this generic transaction, also defined in the
dictionary (line 33). The dictionary description of custupd-global and customer is as
follows:
Figure 9-28. Setting up Transaction-Specific Data in the Dictionary
Note that the user of the system has added the element password to the custupd-global
list. This element is not a part of the core application.
The program depends upon the existence of error, yes, and no as the way in which the
subprogram indicates to the main program that an error has been detected. The main
program initializes these variables in lines 29 to 31.
FILE custupd-global
FILE TYPE: RESPONSIBILITY:
CUSTUPD-GLOBAL FORM
ELEMENT(ALIAS): PROPERTIES: ELEMENT(PRIMARY):
PASSWORD X (8,0,8) PASSWORD
ERROR I (4,0,2) ERROR
YES I (4,0,2) YES
NO I (4,0,2) NO
FILE customer
FILE TYPE: RESPONSIBILITY:
CUSTOMER MAST
ELEMENT(ALIAS): PROPERTIES: ELEMENT(PRIMARY):
CUST-NO * I+(6,0,4) CUST-NO
NAME X (20,0,20) NAME
STREET-ADDR X (20,0,20) STREET-ADDR
CITY-STATE X (20,0,20) CITY-STATE
AREA X (6,0,6) AREA