Define program actions and events using Online Express.
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.
In AppMaster Builder, you define program logic using Online Express to create events and assign actions to those events. Some
actions are pre-defined or reserved by AppMaster Builder, and you can define custom actions as well.
When you have completed this tutorial, the BLDRUPD program will perform the following actions:
Action
|
Description
|
Query
|
Reads database records and moves data to screen fields
|
Update
|
Updates the records by moving data from screen fields to the records
|
Delete
|
Deletes database records
|
Term
|
Terminates the program
|
The end user executes these database and teleprocessing actions by entering a function code in the screen entry field named
Function. Users can also return to the Main Menu program of the application by pressing the
F3 function key.
Requirements
Before attempting this tutorial, you must complete:
If you have closed
Enterprise Developer, start it; then open the AppMaster Builder perspective and, from the
Project Explorer, double-click the
BLDRUPD program to start Online Express.
Define Program Actions for the BLDRUPD Program
- Start the Action/Event Editor
-
- On the
Control Type list, click
Function Field.
- On the
Control Name list, double-click
Function. The Action/Event Editor appears.
- Define Query database action
-
- From the
Function Field drop-down list box, click
Function.
- Click
Edit > Create. A new function line appears on the Action/Event Editor.
- In the
Event field, type
Q.
- From the
Action drop-down list, click
Reserved.
- From the
Argument drop-down list, click
*QUERY.
- Define remaining database actions
-
- Repeat steps
2 through
5 in
Define Query database action one time for each action listed in the following table, substituting the appropriate event, action, and argument for each:
Event
|
Action
|
Argument
|
U
|
Reserved
|
*UPDATE
|
D
|
Reserved
|
*DELETE
|
C
|
Reserved
|
*CLEAR
|
E
|
Reserved
|
*TERM
|
- Complete program actions
-
- On the Action/Event Editor, click
Apply.
- Close the Action/Event Editor. The Action/Event Browser shows all assigned actions.
- Assign an action to the PF3 key
- Previously, we assigned the
PF3 key to bypass field edits. In this section, we assign the
PF3 key to also escape from the Parts Update program and transfer you back to the Main Menu program.
- From the
Control Type list, choose
KEYS.
- On the
Control Name list, double-click
PF1-PF12. The Action/Event Editor dialog box appears.
- Click the
PF3 row.
- From the
Action drop-down list, select
XCTL.
- In the
Argument field, type
bldrcmnu.
- Click
Apply.
- Close the Action/Event Editor. The Action/Event Browser reappears.
- Code working-storage fields
- The screen fields that we created using the Screen Painter and mapped to working-storage fields in a previous tutorial need
corresponding working-storage fields in our program. In Online Express we can code a record for these fields as Miscellaneous
User Code using the S-COBOL language, which is a short-hand version of COBOL. S-COBOL is read by the Micro Focus Generator
(MFG) and translated into native COBOL. The record coded here receives the data from our VSAM file.
- On the Action/Event Browser on the
Control Type list, click
All.
- On the
Control Name list, click
All.
- Click
Action/Event > Edit Miscellaneous User Code. This brings up your default editor.
- Code the following S-COBOL record into the editor. Code the WS on the first line in column 4. Continue the line starting in
column 12. Indent the code for the remainder of the record under the first line. Use the field on the bottom right of the
editor to be sure you have the code placed in the proper columns.
WS WS-MASTER-RECORD
WS-PART-NUMBER 9(8)
WS-SHORT-DESC X20
WS-UNITS-INSTOCK 99
WS-BASE-PRICE 9(4)V99
WS-DIMENSIONS X8
FILLER X36
- To save your source code, click
File > Save.
- Exit the editor. This returns you to the Action/Event Editor.
This completes the tutorial. Next, please complete
Tutorial: Define Database Access.