The Product Process [ HP ALLBASE/4GL Developer Self-Paced Training Guide ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Self-Paced Training Guide
The Product Process
The process you are about to develop calls a data screen. When the user
completes the screen, the same process writes the data entered by the
user to the product file. The process then loops back to the beginning
to start again.
Many processes call data screens. The training application uses a menu
item to call a process, which in turn displays a data screen and then
manipulates data in a file.
For the training application, the user must press the Previous Menu
function key to exit from the process. After pressing the Previous Menu
function key the user is taken back to the menu that called the process.
Task 1 - Defining the Process Header
The first task in defining the process is to define the process header.
This involves two steps. First you must define a process header, and
then define the steps that make up the process on the process details
screen.
Menu Path
To access the screen:
1. From the main menu, select the Logic menu item.
2. Choose Processes.
3. Choose Header.
Process Header Screen
Screen Description
This screen enables you to enter a brief description of the process for
documentation purposes.
To enter the field values:
Field Entry Explanation
---------------------------------------------------------------------------------------
Process Name product_proc The name of the process within the
application.
Description Enter a suitable Used for documentation purposes.
description.
To complete and commit the screen:
1. Press the Commit Data function key to create the process header.
Once you've done this, go to the Process Details screen to create the
process logic block.
Task 2 - Defining the Process Details
Now that you have created the process header, you can define the details
of the process.
Menu Path
To access the screen from the main menu:
1. Select the Logic option.
2. Choose Processes.
3. Choose Details.
Process Details Screen
Screen Description
This screen allows you to create the command lines that make up the
process logic block. The screen is divided into two distinct regions.
The upper region displays 10 of the 99 lines allowed in the logic block.
This range is scrolled up and down to display the current line in the
logic block as you work through it.
The lower region allows you to enter commands. Three fields are always
displayed in the lower region. These are the current step number,
action, and command name. Below this a window is sometimes displayed,
and this is where the remainder of the command line is entered or
displayed.
Process Details Windows
HP ALLBASE/4GL displays special windows for commands that have a more
complex syntax. This special window steps you through the syntax of the
particular command. HP ALLBASE/4GL displays the window after you enter a
command name in the Command field.
The simpler commands use a free format window for you to enter the rest
of the command. Some commands don't have options, so no window is
displayed.
You will see examples of each of these methods as you enter the steps for
this process.
About the Process
Because each data manager is different, sometimes the logic that you
write will vary according to the data manager you are using. In
particular, commands that read or write to a data manager may vary.
This process, and some other processes and functions that you will create
later, is slightly different for each data manager. Follow the
instructions for the appropriate data manager. If you wish, take a look
at the logic for other data managers to see how the logic varies for the
needs of each data manager.
If you are developing the KSAM based application, read on below.
If you are developing the HP ALLBASE/SQL based application, turn to HP
ALLBASE/SQL Based Applications.
If you are developing the HP TurboIMAGE/iX based application, turn to HP
TurboIMAGE/iX Based Applications.
KSAM Based Applications
For KSAM based applications, this is the process you are going to create.
1 MODE *WRITE product
2 SCREEN product_scrn
3 FILE *WRITE product
4 ENTER 2
What the Process Does
This process is quite simple.
* In the first line the MODE command specifies how the application
can access data files. In this case, the application has write
access to the data file called product.
* The SCREEN command in the second line displays the product_scrn
screen.
* The FILE command in the third line writes data from the file
record buffer to the product file.
* The ENTER 2 command in the last line causes the process to execute
again from step number 2.
* The user can exit from the process by pressing the Previous Menu
function key at any time.
KSAM Process Details Screen
Enter the steps for this process as shown below.
To enter the field values:
Field Entry Explanation
---------------------------------------------------------------------------------------
Process Name product-proc The default name in this field, if you have
just defined the header for the process.
Using Open Window Commands.
The first two commands use the open window method for you to enter the
remainder of the step.
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default. The number of the step in the logic block
that you are defining.
It is not necessary for step numbers to be
contiguous. You can leave blank lines
within a logic block.
Action Accept the default. An action code much like the one used to
create the record layout details. It
defaults to A indicating add for a new
step, or C indicating change for an
existing step.
The other valid actions available are D to
delete a step, I to insert a step, R to
replace a step, L to list the whole logic
block, and S to swap the display pages if
your logic block is longer than the ten
lines displayed in the window.
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
Command MODE When you enter this command name, HP
ALLBASE/4GL presents a free form data entry
area at the base of the screen so you can
enter the remainder of the command. HP
ALLBASE/4GL automatically upshifts a
lower-case entry.
The MODE command sets the usage mode for a
file while a process is active. By
default, HP ALLBASE/4GL opens files for
read access only. Refer to the HP
ALLBASE/4GL Developer Reference Manual for
more information about this command and any
others you encounter in this manual.
Pressing the Command Help function key on
the process (or function) details screens
displays several further sets of function
keys that allow you to select the help
screen you want.
To Complete the *WRITE product Specifies that you want to write to the
Command product file. Note that you don't need to
enter the word write in uppercase letters.
To complete this command:
1. Press Commit Data .
This commits the step. HP ALLBASE/4GL clears the window and shows
the new command line in the display region of the screen.
The cursor returns to the Step Number input field so you can proceed to
enter the next command. The step number is automatically incremented as
you build the logic block.
To enter the next command:
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default Notice that it is automatically incremented
value. as you create each line of the logic block.
If the current step is not displayed in the
upper region of the screen, then the logic
block is scrolled to ensure that the step
is displayed.
Action Accept the default
action.
Command SCREEN
To Complete the Enter product_scrn This command tells HP ALLBASE/4GL to
Command display the product_scrn screen. After the
process is executed, control returns to the
process when the end user terminates the
screen by pressing the Commit Data
function key on this screen.
To complete this command:
1. Press Commit Data .
This displays the second command line in the display region of the
screen. It also clears the command window and returns the cursor to the
Step Number input field.
To enter the next process:
This process uses a command sensitive window to enter the remainder of
the command line.
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default.
Action Accept the default
action.
Command Enter FILE Displays a special window to prompt for
further details. The window appears after
you enter the command name FILE.
*WRITE Try entering an invalid file operation. HP
ALLBASE/4GL displays a message informing
you that the operation is invalid. The
cursor remains on the field and you must
correct the entry before you can move on.
This shows you how the command sensitive
window helps you enter the correct command
structure. Also note that you don't need
to enter the asterisk before the command
name. HP ALLBASE/4GL enters it for you.
Since the file used in this process has
unique primary key values, it is possible
to use the *WRITE option to both add or
modify a record in the file.
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
*NOLOCK Accept the default. Specifies whether this command imposes a
lock on the file as it is accessed. The N
option specifies that normal locking
applies. (That is, the NOLOCK option is
not used.)
File ID[.Record] Enter product The name of the file that is used for this
operation. You can append a record
specifier to the file name. This is only
necessary if you want to access a file
using a record layout other than the
default record layout.
The remaining fields on the FILE command window are optional. You will
use some of these fields later in this training course. For the moment,
leave them blank.
To complete this command:
1. Press Commit Data .
When you press this key, HP ALLBASE/4GL clears the window and displays
the command on the third line of the process logic block. Notice that
the fields for which you made no entry are omitted from the command.
To enter the fourth command:
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default.
Action Accept the default
action.
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
Command ENTER When you enter this command name, HP
ALLBASE/4GL presents a free form data entry
area at the base of the screen so you can
enter the remainder of the command.
The ENTER command passes control to another
line of the process to execute it again.
To Complete the 2 This specifies that you want to pass
Command control to line 2 of the process.
To complete this command:
1. Press Commit Data .
The new command line is displayed and the cursor returns to the Step
Number field.
Completed Process Details Screen
The next step in creating a process is to generate it. This procedure is
the same for all data managers. Turn to "Generating a Logic Block" to
continue the training course and to generate the process.
Creating an SQL Process
For HP ALLBASE/SQL based applications, you are going to create the
following process.
1 MODE *WRITE product
2 SCREEN product_scrn
3 FILE *INSERT product
4 SQL commit
5 ENTER 2
What the Process Does
This process is quite simple.
* In the first line the MODE command specifies how the application
can access data files. In this case the application has write
access to the data file called product.
* The SCREEN command in the second line displays the product_scrn
screen.
* The FILE command in the third line inserts data from the file
record buffer to the product file.
* The SQL command calls an SQL logic block to commit the work. You
will create the SQL logic block in Lesson 8.
* The ENTER command in the last line causes the process to execute
again from step number 2. The user can exit from the process by
pressing the Previous Menu function key at any time.
The screen that follows shows how the finished process will look.
Completed ALLBASE/SQL Process Details
To enter the field values:
You can now enter the data required to define the process. Each entry is
detailed below.
Field Entry Explanation
---------------------------------------------------------------------------------------
Process Name product_proc This will be the default name in this field
if you have just defined the header for the
process.
Using Open Window Commands.
The first two commands use the open window method for you to enter the
remainder of the step.
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default. The number of the step in the logic block
that you are defining.
It is not necessary for step numbers to be
contiguous. You can leave blank lines
within a logic block.
Action Accept the default. This is an action code much like the one
you used to create the record layout
details. It defaults to A indicating add
for a new step, or C indicating change for
an existing step.
The other valid actions available are D to
delete a step, I to insert a step, R to
replace a step, L to list the whole logic
block, and S to swap the display pages if
your logic block is longer than the ten
lines displayed in the window.
Command MODE When you enter this command name, HP
ALLBASE/4GL presents a free form data entry
area at the base of the screen so you can
enter the remainder of the command.
Notice that you don't have to enter
upper-case characters. HP ALLBASE/4GL
automatically upshifts a lower-case entry.
The MODE command sets the usage mode for a
file while a process is active. By
default, HP ALLBASE/4GL opens files for
read access only.
You can get a brief description of a
command by pressing the Command Help
function key on the process (or function)
details screens. This function key
displays several further sets of function
keys that allow you to select the help
screen you want.
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
To Complete the *WRITE product This specifies that you want to write to
Command the product file. Note that you don't need
to enter the word write in uppercase
letters.
To complete this command:
1. Press Commit Data .
This commits the step. HP ALLBASE/4GL clears the window and shows the
new command line in the display region of the screen. The cursor returns
to the Step Number input field so you can proceed to enter the next
command. The step number is automatically incremented as you build the
logic block.
To enter the next command:
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default. Notice that it is automatically incremented
as you create each line of the logic block.
If the current step is not displayed in the
upper region of the screen, then the logic
block is scrolled to ensure that the step
is displayed.
Action Accept the default.
Command SCREEN
To Complete the product_scrn This command tells HP ALLBASE/4GL to
Command display the product_scrn screen.
When the process is executed, control
returns to the process when the end user
terminates the screen by pressing the
Commit Data function key on this screen.
To complete this command:
1. Press Commit Data .
This displays the second command line in the display region of the
screen. It also clears the command window and returns the cursor to the
Step Number input field.
A Special Window Command
The next step uses a command sensitive window to enter the remainder of
the command line.
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default.
Action Accept the default.
Command FILE The file command displays a special window
to prompt for further details. The window
appears after you enter the command name
FILE.
*INSERT If you enter an invalid file opeation, HP
ALLBASE/4GL displays a message informing
you that the operation is invalid. The
cursor remains on the field and you must
correct the entry before you can move on.
This shows you how the command sensitive
window helps you enter the correct command
structure. Also note that you don't need
to enter the asterisk before the command
name. HP ALLBASE/4GL enters it for you.
*NOLOCK Accept the default. Specifies whether this command imposes a
lock on the file as it is accessed. The N
option specifies that normal locking
applies. (That is, the NOLOCK option is
not used.)
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
File ID[.Record] product The name of the file that is used for this
operation. You can append a record
specifier to the file name. This is only
necessary if you want to access a file
using a record layout other than the
default record layout.
The Remaining Fields
The remaining fields on the FILE command window are optional. You will
use some of these fields later in this training course. For the moment,
leave them blank.
To complete this command:
1. Press Commit Data .
When you press this key, HP ALLBASE/4GL clears the window and displays
the command on the third line of the process logic block. Notice that
the fields for which you made no entry are omitted from the command.
To enter the next command:
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default.
Action Accept the default.
Command SQL This displays an open window.
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
To Complete the commit This command calls an SQL logic block
Command called commit. You will create this SQL
logic block in Lesson 8.
HP ALLBASE/SQL requires you to issue an
explicit COMMIT WORK to complete a
transaction and make it permanent in the
database. If you terminate a transaction
or attempt to start a new transaction
without issuing a commit work command, HP
ALLBASE/SQL reverses any currently open
transaction. The commit SQL logic block
will issue the COMMIT WORK command.
To complete this command:
1. Press Commit Data .
This displays the fourth command line in the display region of the
screen. It also clears the command window and returns the cursor to the
Step Number input field.
To enter the final command:
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default.
Action Accept the default.
Command ENTER When you enter this command name, HP
ALLBASE/4GL presents a free form data entry
area at the base of the screen so you can
enter the remainder of the command.
The ENTER command passes control to another
line of the process to execute it again.
To Complete the 2 Specifies that you want to pass control to
Command line 2 of the process.
To complete this command:
1. Press Commit Data .
The new command line is displayed and the cursor returns to the Step
Number field.
Generating the Process.
The next step in creating a process is to generate it. This procedure is
the same for all data manaagers. Turn to the section "Generating a Logic
Block" to continue the training course and to generate the process.
Notes on Entries.
SQL Command Equivalent
The FILE *INSERT command inserts the current contents of the product file
buffer into the product table as a new row.
This command is equivalent to the SQL command:
INSERT INTO sqlgrp.product
VALUES (:F-product_no.product,
:F-description.product,
:F-supplier_no.product,
:F-lead_time.product);
In this application, the user cannot attempt to insert a row into the
product table if a row with the same value in the product_no field
already exists. If the application logic allows the user to attempt an
insert operation that causes an index uniqueness violation, HP
ALLBASE/SQL generates an error message. If the FILE command has an
optional error command, control would pass to the error command if such
an error occurred.
Creating an HP TurboIMAGE/iX Process
For HP TurboIMAGE/iX based applications, this is the process you are
going to create.
1 DM IMAGE *MODE *MODLOCK :D-traindb
2 MODE *WRITE product
3 SCREEN product_scrn
4 FILE *WRITE product
5 DM IMAGE *UNLOCK :D-traindb
6 ENTER 3
What the Process Does
This process is quite simple.
* In the first line the DM IMAGE
* MODE command specifies how the application can access the traindb
database. In this case the application has read access, and write
access if the part of the database that you wish to write to is
locked by the application.
* In the second line, the MODE *WRITE command also specifies how the
application can access the data, but this is specific to the
product data set only. This command must be used in conjunction
with the DM IMAGE *MODE command, and must not offer greater
capability than the DM IMAGE
* MODE command.
* The SCREEN command in the third line displays the product_scrn
screen.
* The FILE command in the fourth line writes data from the file
record buffer to the product file.
* When the screen field product_no is entered, a function
product_key_read is called that locks and reads the data set. The
DM IMAGE *UNLOCK command releases all locks held by this process
on the traindb database.
In this case, the lock on the record placed by the
product_key_read function is the only lock released. The lock on
the data set is held from the time the user enters a product
number until after the user presses the Commit Data function
key.
* The ENTER 3 command in the last line causes the process to execute
again from step number 3. The user can exit from the process by
pressing the Previous Menu function key at any time. The
process should be entered as shown below.
Completed HP TurboIMAGE/iX Process Details Screen
To enter the field values:
Field Entry Explanation
---------------------------------------------------------------------------------------
Process Name product_proc This will be the default name in this field
if you have just defined the header for the
process.
Open Window Commands
The first three commands use the open window method for you to enter the
remainder of the step.
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default. The number of the step in the logic block
that you are defining.
It is not necessary for step numbers to be
contiguous. You can leave blank lines
within a logic block.
Action Accept the default. This is an action code much like the one
you used to create the record layout
details. It defaults to A indicating add
for a new step, or C indicating change for
an existing step.
The other valid actions available are D to
delete a step, I to insert a step, R to
replace a step, L to list the whole logic
block, and S to swap the display pages if
your logic block is longer than the ten
lines displayed in the window.
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
Command DM When you enter this command name, HP
ALLBASE/4GL presents a free form data entry
area at the base of the screen so you can
enter the remainder of the command.
Notice that you don't have to enter
upper-case characters. HP ALLBASE/4GL
automatically upshifts a lower-case entry.
The DM command is used as a prefix to logic
commands specific to a certain data
manager. Currently, HP ALLBASE/4GL only
offers data manager specific commands for
the HP TurboIMAGE/iX data manager.
You can obtain a brief description of a
command by pressing the Command Help
function key on the process (or function)
details screens. This function key
displays several further sets of function
keys that allow you to select the help
screen you want.
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
To Complete the IMAGE *MODE *MODLOCK The DM IMAGE *MODE command specifies how
Command :D-traindb the application can access one or more
databases.
In this case, you are setting the access
mode for the traindb database. Each access
mode represents an HP TurboIMAGE/iX access
mode. The access mode *MODLOCK is
equivalent to HP TurboIMAGE/iX access mode
1. This mode gives the application read
access, and write access if the part of the
database to be altered is locked before
being altered. It is not necessary to use
a lock to read the database.
To complete this command:
1. Press Commit Data .
This commits the step. HP ALLBASE/4GL clears the window and shows the
new command line in the display region of the screen.
The cursor returns to the Step Number input field so you can proceed to
enter the next command. The step number is automatically incremented as
you build the logic block.
To enter the next command:
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default. Notice that it is automatically incremented
as you create each line of the logic block.
If the current step is not displayed in the
upper region of the screen, then the logic
block is scrolled to ensure that the step
is displayed.
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
Action Accept the default.
Command MODE
To Complete the *WRITE product This command tells HP ALLBASE/4GL that it
Command may execute any commands that require write
access to the product data set.
To complete this command:
1. Press Commit Data .
This displays the second command line in the display region of the
screen. It also clears the command window and returns the cursor to the
Step Number input field.
To enter the next command:
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default.
Action Accept the default.
Command SCREEN
To Complete the product_scrn This command tells HP ALLBASE/4GL to
Command display the product_scrn screen. When the
process is executed, control returns to the
process when the end user terminates the
screen by pressing the Commit Data
function key on this screen.
To complete this command:
1. Press Commit Data .
This displays the third command line in the display region of the screen.
It also clears the command window and returns the cursor to the Step
Number input field.
Using a Special Window Command.
The next step uses a command sensitive window to enter the remainder of
the command line.
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default.
Action Accept the default.
Command FILE The file command displays a special window
to prompt for further details. The window
appears after you enter the command name
FILE.
*WRITE If you enter an invalid file operation, HP
ALLBASE/4GL displays a message informing
you that the operation is invalid. The
cursor remains on the field and you must
correct the entry before you can move on.
This shows you how the command sensitive
window helps you enter the correct command
structure. Also note that you don't need
to enter the asterisk before the command
name. HP ALLBASE/4GL enters it for you.
Since the file used in this process has
unique primary key values, it is possible
to use the *WRITE option to both add or
modify a record in the file.
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
*NOLOCK Accept the default. Specifies whether this command imposes a
lock on the file as it is accessed. The N
option specifies that normal locking
applies. (That is, the NOLOCK option is
not used.)
File ID[.Record]. product The name of the file that is used for this
operation. You can append a record
specifier to the file name. This is only
necessary if you want to access a file
using a record layout other than the
default record layout.
Remaining Fields
The remaining fields on the FILE command window are optional. You will
use some of these fields later in this training course. For the moment,
leave them blank.
To complete this command:
1. Press Commit Data .
When you press this key, HP ALLBASE/4GL clears the window and displays
the command on the third line of the process logic block. Notice that
the fields for which you made no entry are omitted from the command.
To enter the second DM command:
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default.
Action Accept the default.
Command DM When you enter this command name, HP
ALLBASE/4GL presents a free form data entry
area at the base of the screen so you can
enter the remainder of the command.
Table 4-0. (cont.)
Field Entry Explanation
---------------------------------------------------------------------------------------
To Complete the IMAGE *UNLOCK This command unlocks all locks held by the
Command :D-traindb process on the traindb database or on any
part of the traindb database.
On this occasion there is only one lock;
this lock is created in the
product_key_read function that you will
create soon. The function is called from
the product_scrn screen and is executed
while the process is active, so it is
classified as a lock held by the process.
To complete this command:
1. Press Commit Data .
The new command line is displayed and the cursor returns to the Step
Number field.
To enter the last command:
Field Entry Explanation
---------------------------------------------------------------------------------------
Step Number Accept the default.
Action Accept the default.
Command ENTER When you enter this command name, HP
ALLBASE/4GL presents a free form data entry
area at the base of the screen so you can
enter the remainder of the command.
The ENTER command passes control to another
line of the process to execute it again.
To Complete the 3 This specifies that you want to pass
Command control to line 3 of the process.
To complete this command:
1. Press Commit Data .
The new command line is displayed and the cursor returns to the Step
Number field.
Generating the Process.
The next step in creating a process is to generate it. This procedure is
the same for all data managers.
MPE/iX 5.0 Documentation