Getting Started with TRANSACT (32247-90007)
160 Chapter9
Creating Custom Applications
Form Independence
Figure 9-10. Screen Independence, Accounts Payable Customer Update
There are many ways to implement a form-independent program. The above is just one
illustration. The key to this implementation is the MPE file called FORMXREF which
provides the indirection we need to establish form independence.
The content of FORMXREF is as follows:
Figure 9-11. Screen Independence, Form Cross Reference File
MENUNAME and FKEY are the index into the file specifying the menu that the user is
currently working with and the function key just pressed by the user to indicate the next
form to go to. SCREEN contains the name of the next data entry form to use.
When this program begins, the element menuname contains the name of the menu that
controls its functionality. Line 11 simulates this by prompting for the menu name. When
prompted for the menu name, we typed in CUSTUPDATEMM.
The menu we have set up allows the user to specify the next form in either of two ways.
The name of the form can be entered in the box titled enter screen name. The [[ENTER]]
enters this data and lines 30 and 31 detect this and perform the update routine. Or, the
form can be indicated via a function key. If this way is chosen, the file formxref is accessed
to determine the form name to be used by the modify routine. Lines 34 through 39
accomplish this.
The cross reference file has a record for each function key of each form that defines the
name of the form to use when that function key is pressed. In our example, if the user
presses [[ F1 ]], then form custupdate1 is used.
Another form for updating a customer could now be designed and used by this program
merely by recompiling the program. Of course, the form would have to be designed in
FORMSPEC and defined in the data dictionary first.
custupdate3 accounts payable customer update
customer number [1 ]
name [name of customer 1 ]
address [108 Lincoln Ave. ]
city,state [So. Bend, Ind. ]
zipcode [12345 ]
update? - f1=yes, f2=no
MENUNAME: FKEY: SCREEN:
----------------------------------
CUSTUPDATEMM 1 CUSTUPDATE1
CUSTUPDATEMM 2 CUSTUPDATE2
CUSTUPDATEMM 3 CUSTUPDATE3