Creating the modify_option Function [ HP ALLBASE/4GL Developer Self-Paced Training Guide ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Self-Paced Training Guide
Creating the modify_option Function
The modify_option function is very similar to the modify_product function
you created in lesson 15, chapter 7, so no explanation is provided. You
should be able to interpret the function's behavior. The function
details for each data manager are listed below and on the following
pages.
To create the function forKSAM Based
Applications:
1. Create and generate this function.
Function - modify_option
1 IF V-option_status = C-no_record THEN
MESSAGE no_option ; EXIT
2 FILE *WRITE option ; ENTER 5
3 MESSAGE opt_modify_ok
4 EXIT
5 MESSAGE file_error
6 EXIT
2. Now turn to the following page to create the messages required by
the function.
To create the funciton for HP ALLBASE/SQL Based
Applications:
1. Create and generate this function now.
Function - modify_option
1 IF V-option_status = C-no_record THEN
MESSAGE no_option; EXIT
2 SQL modify_option ; ENTER 5
3 MESSAGE opt_modify_ok
4 EXIT
5 MESSAGE file_error
6 EXIT
This function calls the SQL logic block modify_option.
SQL Logic Block - modify_option
2. Create and generate the modify_option SQL logic block. It
modifies a row in the product table.
UPDATE sqlgrp.option SET
description = :F-description.option,
cost = :F-cost.option,
quantity = :F-quantity.option,
unit_measure = :F-unit_measure.option
WHERE CURRENT OF option_key_sel;
This SQL logic block updates the row of the table defined by
the present position of the option_key_sel cursor. The
option_key_read function declares and opens this cursor when it
calls the SQL logic block option_key_sel.
Note that the cursor name is the name of the SQL logic block
containing the SELECT command that declares and opens the cursor.
3. Now turn to the Message heading below the following HP
TurboIMAGE/iX instructions.
To complete the function for HP TurboIMAGE/iX Based
Applications:
1. Create and generate this function now.
Function - modify_option
1 IF V-option_status = C-no_record THEN
MESSAGE no_option ; EXIT
2 FILE *WRITE option *INDEX=option_no ; ENTER 5
3 MESSAGE opt_modify_ok
4 EXIT
5 MESSAGE file_error
6 EXIT
2. Next, create the messages required for this function.
To create the messages for the modify_option
function:
1. Create the following messages.
a. Message - no_option
Name no_option
Type WARN
Contents "No option for modification."
b. Message - opt_modify_ok
Name opt_modify_ok
Type MESS
Contents "Option number"
F-option_no.option
" has been modified."
MPE/iX 5.0 Documentation