The Application You Will Create [ HP ALLBASE/4GL Developer Self-Paced Training Guide ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Self-Paced Training Guide
The Application You Will Create
You can create a wide variety of types of applications using HP
ALLBASE/4GL. Following is a description of the training application, the
one you will create using this training guide.
The training application is a simplified product listing. It consists of
one menu and one screen. Four data items have been identified for the
application: product number, description, supplier number, and lead
time. For each of those items you will do the following:
* Create dictionary definitions, record layouts, and data files
* Create the menu and screen
* Define the logic required
* Design a report for the application
* Test the application to make sure it runs
How the Application Will Work
The initial action in an application can be either a menu or a process.
In this application, the initial action is the menu. When the user signs
on to the training application, HP ALLBASE/4GL will automatically display
the menu for the application.
When the user selects the Product Details option on the main menu, the
application will execute a process called product_proc. This process
displays the product_scrn screen.
The product_scrn Screen
The four data fields defined for the application are shown above on the
application's product_scrn screen.
The product_scrn screen will have a function associated with the first
field. After the user has completed data entry in the product number
field, this function reads the product file for a record matching the
product number just entered. If a matching record does not exist, the
user can enter the details for a new record.
If a matching record exists, the function displays the details of the
record on the screen. The user can now modify the details of the record.
When the user presses the Commit Data function key, control returns to
the process. The process updates the product file to reflect the new or
changed data entered by the user, and then displays the screen again.
To exit from the process, the user must press the Previous Menu
function key.
Application Structure
The underlying structure of the application can be represented as shown
in the following diagram.
You can consider an application as being a series of linked elements. In
this case, the sequence of elements is a process, a screen, and then a
function. All the elements in a sequence such as this are identified by
a name.
Application Structure
One standard format for constructing applications is to use a process to
call a screen, and, on exit from the screen, return to the process to
update one or more files to reflect data entered while the screen is
active. A function associated with a screen field can be used to perform
a file lookup while the screen is active.
This structure emphasizes the similarity between an HP ALLBASE/4GL
process and a program in a conventional language, and the similarity
between an HP ALLBASE/4GL function and a conventional language
subroutine.
When a process starts, it initializes the environment to a known state.
This means that all application data files are closed; all file record
buffers, work areas, and screen buffers are cleared; any current process,
function, screen, decision table, or report is terminated; and any
incomplete HP ALLBASE/SQL transaction is reversed. Using a process to
control the screen and subsequent file update means that the screen
display and file update occur within a known and controlled environment.
An HP ALLBASE/4GL application only allows one process to operate at a
time. In this case, the process remains active and controls the
application until the user terminates it by pressing the Previous Menu
function key.
The function associated with the first field on the screen behaves
somewhat like a subroutine. It performs a file lookup, and the
application then continues from the point where the function was called
after the file lookup is complete. The function does not change the
overall environment for the application.
The flow of control on exit from different types of application items
operates according to the following rules.
Item Control returns to ...
Process The last menu displayed by the application. If no
menu has been displayed, the application terminates.
Function The item that called the function.
Data screen The next command in the logic block that called the
screen, or the previous menu if the screen was called
from a menu.
This application structure will become apparent as you perform the tasks
needed to develop the training application. This application was
designed to help you become familiar with HP ALLBASE/4GL and to
demonstrate the logic and data processing capabilities associated with
its screens. In chapter 2 we will begin the process of developing the
training application.
MPE/iX 5.0 Documentation