Using the RPG Screen Interface (RSI) [ HP RPG/iX Reference Manual ] MPE/iX 5.0 Documentation
HP RPG/iX Reference Manual
Using the RPG Screen Interface (RSI)
To use RSI in an RPG program, perform the following steps (each of the
steps is explained in detail in the following sections in this chapter):
1. Create the RSI forms file using the RPG utility, SIGEDITOR.
2. Specify screen-related options and define the RSI forms file using
File Description, Input and Output Specifications.
3. If necessary, you can enter Calculation Specifications to perform
auxiliary processing for the RSI file. You condition operations
using one or more of the RPG indicators including the command key
indicators (KA-KN, KP-KY).
You can perform exception output and demand input of an RSI form
by using the EXCPT and READ operations, respectively.
Using SIGEDITOR
To create or modify an RSI forms file, you must use the RPG utility,
SIGEDITOR. (See the RPG Utilities Reference Manual.) SIGEDITOR gives you
complete flexibility in defining an RSI form. You define where the
fields are located, their lengths and data types and the values they can
contain.
In addition to defining fields, you can enable any or all of the command
key indicators (KA-KN, KP-KY). The command key indicators let RSI
communicate events to the RPG program at run time. For example, a data
entry operator (user) can press a certain key to end the program. This
turns ON the associated command key indicator. See the section
"Executing an RSI Program" for information on the command keys and the
command key indicators associated with them.
[REV BEG]
Redefining Function Key Labels
An RSI form by default displays the following key labels for enabled
function keys:
COMMAND *PRINT f3 f4 f5 *HELP f7
DUPL
SCREEN
f1 f2 f3 f4 f5
f6 f7 f8
The key labels for f1 and f8 cannot be changed, but you can specify
labels for the keys f2 through f7 by taking these steps:
1. Add a $CONTROL compiler command with the FKEYLBL parameter to your
program.
2. Add a File Extension Specification defining an array of 8 elements
with 16 alphanumeric characters in each element. The first 8
characters of each element are the first line of the label, and
the second 8 characters are the second line of the label.
3. Add a Calculation Specification using the SET operator to load
your array into the key labels. Place this statement before the
one displaying the RSI form.
Remember that you can redefine labels for only function keys f2 through
f7, and of those, for only the ones that were enabled when the RSI form
was created with SIGEDITOR. Your label array must include labels for all
eight function keys, though labels for the first, last, and disabled keys
may be blank because they will be ignored.[REV END]
Using the RSI Application Help Facility
The RSI application help facility consists of "help areas" and "help
forms." Both are created using the SIGEDITOR. (See the RPG Utilities
Reference Manual.) The SIGEDITOR can also create help areas from IBM "H"
specifications.
Help areas are imaginary boundaries that are overlayed on the application
form. Up to 256 help areas are allowed on an individual application
form. When the user presses F6 (HELP), RSI notes the cursor position and
scans a list of help area definitions for the first one that covers the
cursor position. The help area definition contains the name of the first
help form to display. Additional help forms, if available, can be
displayed using F3 (ROLL UP) and F4 (ROLL DOWN) keys. The user can
return to the application form by pressing ENTER.
Help forms are ordinary RSI forms, except that they are made of text
only. The text can start on any line from 01-24 and can clear up to 24
lines. Help forms can overlay other help forms, but cannot overlay the
application form. Help forms must not contain any fields, video
enhancements, or message constants. They cannot use the variable
starting line number feature. If a help form contains any unsupported
specifications, they are ignored when the form is displayed.
An RSI application using the help facility must be prepared with DS
capability before use in an RPG program. The application form must have
the F6 (HELP) key disabled. No additional RPG programming is required to
use the basic RSI application help facility. If you want to use the
suppressed selection or boundary features, you must enter RPG calculation
specifications to control these indicators.
Entering File Description Specifications
To use an RSI forms file in a program, you must define it as a WORKSTN
file in the Device Class Name Field (columns 40-46) of the File
Description Specification for the file. You must also enter R in the
Interface Type Field (column 47) of the File Description Specification.
Table 11-1 describes other fields in the File Description
Specification that you may use with RSI files. The fields that are
optional are followed by an asterisk (*). For more information on the
RSI STATUS array (columns 54-59), see the next section.
Table 11-1. RSI File Description Specifications
-----------------------------------------------------------------------------------------------
| | | |
| Specification | Field | Value |
| Type | | |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| File | File Name(columns 7-14) | The name of the RSI file. |
| Description\(F) | | |
| | | |
| | File Type | U (update). |
| | (column 15) | |
| | | |
| | File Designation\(column 16)| P (primary) or D (demand). |
| | | |
| | Record Format | V (variable-length records). |
| | (column 19) | |
| | | |
| | Logical Record Length | The length of the longest record defined in |
| | (columns 24-27) | the Input and Output Specifications. |
| | | |
| | Device Class Name | WORKSTN. |
| | (columns 40-46) | |
| | | |
| | Interface Type | R (standard RSI file). |
| | (column 47) | |
| | | |
| | Interface Control* | B (enable) or blank (disable) the BREAK |
| | (column 52) | key. |
| | | |
| (Continuation | Option Type* | STATUS The RSI STATUS array (containing |
| line) | (columns 54-59) | 6 elements, each 10 digits long |
| | | with no decimals) is defined |
| | | automatically by RPG. |
| | | |
| | | FORMS The forms file name containing |
| | | forms used by the program. If you |
| | | omit this line, RPG uses the entry |
| | | in the Program Name Field (columns |
| | | 75-80) of the Header Specification |
| | | (with "FM" appended) as the forms |
| | | file name. If there is no program |
| | | name in the Header Specification, |
| | | the forms file name is RPGOBJFM. |
| | | |
| | | TRMID The field name containing the |
| | | terminal identification number. |
| | | |
| | | START The field name containing the |
| | | starting line number for forms with |
| | | variable starting line numbers. |
| | | |
| | | FIRST The name of the form displayed |
| | | during program initialization. |
| | | |
-----------------------------------------------------------------------------------------------
Example
Figure 11-1 shows how to define an RSI forms file in the File
Description Specification. Line 1 defines the file WORKSTN as an RSI
WORKSTN file. Line 2 defines the RSI STATUS array #WSTN#. Line 3 names
the RSI forms file, NEWLIB.
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| 1 FWORKSTN UP V 91 WORKSTNR B |
| 2 F KSTATUS#WSTN# |
| 3 F KFORMS NEWLIB |
| |
| |
___________________________________________________________________________________
Figure 11-1. Entering RSI File Description Specifications
Using the STATUS Array
The STATUS array (declared by a STATUS File Description Continuation
line) is predefined as a 6-element, 10-digit array with zero decimal
places. You can use the STATUS array to determine which function key the
user pressed and where the cursor is positioned on the screen.
In order for RSI to detect the function keys, you must enable them (in
the form's attributes) when running SIGEDITOR.[REV BEG] Also, your
terminal must return the default escape sequences ESCp through ESCw when
the keys f1 through f8 are pressed. See your terminal reference manual
to check this.[REV END]
The first three elements in the STATUS array are used by RSI. They are:
This STATUS element: is set to: when:
1 0 ENTER is pressed.
2 Command key (f1) is pressed.
1121 Print Screen (f2) is pressed.
1122 Roll Up (f3) is pressed.
1123 Roll Down (f4) is pressed.
1124 Clear (f5) is pressed.
1125 Help (f6) is pressed.
1126 Record Backspace (f7) is pressed.
1127 Duplicate (f8) is pressed.
2 Screen row number. One of the function keys is pressed.
3 Screen column number. One of the function keys is pressed.
Entering Input and Output Specifications
There are two ways to enter Input and Output Specifications for an RSI
file:
* You can enter the specifications yourself.
* You can have SIGEDITOR generate the specifications when you define
the form. Once the specifications are generated, you may need to
tailor them for additional requirements.
Table 11-2 describes the fields in the Input and Output
specifications that relate to an RSI forms file. The fields that are
optional are followed by an asterisk (*).
Table 11-2. RSI Input and Output Specifications
-----------------------------------------------------------------------------------------------
| | | |
| Specification | Field | Value |
| Type | | |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| Input (I) | File Name | The name associated with the WORKSTNR |
| (File and Record | (columns 7-14) | device. |
| Description line) | | |
| | | |
| | AND/OR* | AND or OR to complete the identification of |
| | (columns 14-16) | the form. |
| | | |
| | Group Sequence* | A numeric entry for sequence checking or an |
| | (columns 15-16) | alphabetic entry for no sequence checking. |
| | | |
| | Number of Records* | 1 or N if the Group Sequence Field is |
| | (column 17) | numeric. |
| | | |
| | Option* | Blank or 0 if the Group Sequence Field is |
| | (column 18) | numeric. |
| | | |
| | Record Indicator* | The record-identifying indicator used to |
| | (columns 19-20) | identify the form. |
| | | |
| | Record Identification | The record identification codes that |
| | Codes* | identify the form. |
| | (columns 21-41) | |
| | | |
| (Field Description| From Field Position | The first location of the field in the |
| lines) | (columns 44-47) | record. |
| | | |
| | To Field Position | The last location of the field in the |
| | (columns 48-51) | record (for signed numeric fields, do not |
| | | include the sign position). |
| | | |
| | Decimal Positions | A digit that specifies the number of |
| | (column 52) | decimal positions in a numeric field. |
| | | |
| | Field Name | The name of a field or array element. |
| | (columns 53-58) | |
| | | |
| | Field Record Relation* | The field record relation indicator. |
| | (columns 63-64) | |
| | | |
| | Field Indicators* | The field indicators. |
| | (columns 65-70) | |
| | | |
-----------------------------------------------------------------------------------------------
Table 11-2. RSI Input and Output Specifications (cont.)
-----------------------------------------------------------------------------------------------
| | | |
| Specification | Field | Value |
| Type | | |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| Output (O) | File Name | The name associated with the WORKSTNR |
| (Record | (columns 7-14) | device. |
| Description line) | | |
| | | |
| | AND/OR* | AND or OR to relate output indicators on |
| | (columns 14-16) | consecutive lines. |
| | | |
| | Type | H (heading), D (detail), T (total), or E |
| | (columns 15) | (exception). |
| | | |
| | Fetch Overflow/Release | R to close the WORKSTN file after the |
| | (column 16) | specification is executed. |
| | | |
| | Output Indicators* | Output indicators. |
| | (columns 23-31) | |
| | | |
| | Field Name* | The EXCPT Name if the Type Field is E. |
| | (columns 32-37) | |
| | | |
| (First Field | Field Name | The name of an alphanumeric field |
| Description line) | (columns 32-37) | containing the form name (this is not |
| | | required if the Constant/Edit Word Field |
| | | contains the name). |
| | | |
| | End Position | K and the number of characters in the form |
| | (columns 40-43) | name in column 43. |
| | | |
| | Constant/Edit Word | The form name enclosed in quotation marks |
| | (columns 45-54) | (not required if you enter the form name in |
| | | the Field Name Field). |
| | | |
| (Remaining Field | Output Indicators* | Output indicators. |
| Description lines)| (columns 23-31) | |
| | | |
| | Field Name | A field name. |
| | (columns 32-37) | |
| | | |
| | Edit Code* | An edit code. |
| | (column 38) | |
| | | |
| | Blank After* | Blank or B. |
| | (column 39) | |
| | | |
| | End Position | An ending position (for signed numeric |
| | (columns 40-43) | fields, do not include the sign position). |
| | | |
| | Constant/Edit Word* | An edit word or constant. |
| | (columns 45-70) | |
| | | |
-----------------------------------------------------------------------------------------------
Entering Calculation Specifications
You may include Calculation Specifications to condition operations
related to RSI form processing. You can condition operations using any
of the RPG indicators including the command key indicators enabled in
SIGEDITOR (see the previous section "Using SIGEDITOR"). The command key
indicators are turned ON when the user presses the corresponding command
key. (See the next section for a description of the command keys.)
If you need to read or write the RSI screen on a demand basis, use the
READ and EXCPT operations (you must define the file as an update demand
file in the File Description Specification). Unless you specified in
SIGEDITOR that the form is for exception output, EXCPT output is held
until a READ is encountered, then one physical write and one physical
read are performed.
Example
Figure 11-2 shows how to use command key indicator KG to end a
program. (You can use a command key indicator like a general indicator,
but you should only do this when you are not using an RSI WORKSTN file in
the program.)
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| C KG GOTO EOF |
| |
| |
___________________________________________________________________________________
Figure 11-2. Entering an RSI Calculation Specification
Executing an RSI Program
You execute a program that uses RSI the same way you do other RPG
programs. Depending on the features you use in the program and the
environment in which it is run, you may need to perform additional tasks
before running the program. See the next two sections and the sections
at the end of this chapter starting with "Using Different Terminals" to
see if any of these tasks apply to your particular program.
When you run a program that processes an RSI file, the data entry user
issues "commands" to RSI by pressing up to 24 command keys (COMMAND f1
followed by a key on the top row of the keyboard). When a command key is
pressed, the associated command key indicator is turned ON. (You must
have already enabled the command key indicator in SIGEDITOR.). The keys
that you can use on the top row of the keyboard are the shifted and
unshifted keys 1-9, -, and =. They are shown in Figure 11-3 .
Figure 11-3. RSI Command Keys
Table 11-3 lists the command keys and the command key indicators that
correspond to them. When the user presses a command key, the
corresponding command key indicator is turned ON and all other command
keys indicators are turned OFF.
Table 11-3. How RSI Command Key Indicators Are Turned ON
---------------------------------------------------------------------------------------------
| | |
| COMMAND (f1) followed by: | Turns ON this Command Key Indicator: |
| | |
---------------------------------------------------------------------------------------------
| | |
| 1 | KA |
| | |
| 2 | KB |
| | |
| 3 | KC |
| | |
| 4 | KD |
| | |
| 5 | KE |
| | |
| 6 | KF |
| | |
| 7 | KG |
| | |
| 8 | KH |
| | |
| 9 | KI |
| | |
| 0 | KJ |
| | |
| - | KK |
| | |
| = | KL |
| | |
| SHIFT 1 | KM |
| | |
| SHIFT 2 | KN |
| | |
| SHIFT 3 | KP |
| | |
| SHIFT 4 | KQ |
| | |
| SHIFT 5 | KR |
| | |
| SHIFT 6 | KS |
| | |
| SHIFT 7 | KT |
| | |
| SHIFT 8 | KU |
| | |
| SHIFT 9 | KV |
| | |
| SHIFT 0 | KW |
| | |
| SHIFT - | KX |
| | |
| SHIFT = | KY |
| | |
---------------------------------------------------------------------------------------------
NOTE The command keys shown in Table 11-3 are supported on 239x and
262x terminals (264x terminals are also supported but the keys on
the keyboard may not be the same). If you have a different
terminal or a non-standard keyboard, you can can still use RSI with
it but you must define the command keys in the file CMDKEYS.
CMDKEYS enables you to use RSI with any terminal or keyboard
configuration. See the section "Using Different Terminals" for
instructions on how to set up the CMDKEYS file.
Using Messages with RSI.
If you're using messages with an RSI form and you're accessing them by
message identification numbers or you did not merge them with the forms
file in SIGEDITOR, RSI will access the message file CATALOG at run time.
If CATALOG is not the file you want to use, enter an MPE FILE command to
equate CATALOG to that file. For example, if your message file is
INVMSGS, enter this file equation:
:FILE CATALOG=INVMSGS
Displaying an End-of-Program Form.
When you write a display-only form to the screen after the user ends
program input, that form remains on the screen until the user presses
ENTER, an enabled command key, or an enabled function key. To
automatically remove the form from the screen after a few moments, set
the JCW RSIPAUSE before executing the program or use a PUTJW Calculation
Specification operation to set the JCW. When you set the JCW RSIPAUSE,
enter the number of seconds that you want the form to remain on the
screen. If the number is not in the range 1 to 60, it is ignored. In
the following example, the final screen for program INV3470P is displayed
for 15 seconds before the program ends:
:SETJCW RSIPAUSE=15
:RUN INV3470P
Sample RSI Programs
This section shows two versions of a program that uses RSI. One version,
shown in Figure 11-7 , defines the RSI forms file as a primary file
and lets RPG process it normally in the logic cycle. The second version,
shown in Figure 11-8 , defines the RSI forms file as a demand file and
contains Calculation Specifications to read and write screen data using
the forms file.
The sample program updates a customer information file that uses social
security numbers as its key. The user can add or delete persons by
entering their social security number then pressing command keys 1 or 2,
respectively. Or the user can change an individual's address or phone
information by pressing command key 3.
Two RSI forms are used in each version of the program. The first one
that is displayed is shown in Figure 11-4 . If the user wants to add
a record or update one that already exists, a second screen (Figure 11-5
) is displayed. The shaded parts in these figures show where the user
enters data and where output data is displayed. (The screen title and
messages are shown in Figure 11-6 . They are contained in a message
file that was created before the program is executed. You create message
files using GENCAT or MAKECAT. GENCAT is described in the Native Language
Programmer's Guide and MAKECAT is discussed in the Message Catalogs
Programmer's Guide.)
_______________________________________________________________________
| |
| CUSTOMER INFORMATION FORM |
| |
| Please enter Social Security Number |
| |
| 306-46-7778 |
| |
| RECORD ALREADY EXISTS |
| |
| Press CMD 1 TO ADD NEW RECORD |
| CMD 2 TO DELETE EXISTING RECORD |
| CMD 3 TO UPDATE EXISTING RECORD |
| CMD & TO END JOB |
| |
| |
| |
| COMMAND *PRINT f3 f4 f5 *HELP f7 f8 |
| SCREEN |
| |
_______________________________________________________________________
Figure 11-4. Form21 (Contained in RSI Forms File SAMPLIB)
_______________________________________________________________________
| |
| SOC. SEC. NO. 306-46-7778 |
| |
| |
| NAME MARY Q. QUAIL |
| |
| ADDRESS MORSE GROVE, FLA |
| |
| ZIP CODE 339080000 PHONE NO. 813-672-1212 |
| |
| |
| PRESS :ENTER: |
| |
| |
| |
| COMMAND *PRINT f3 f4 f5 *HELP f7 f8 |
| SCREEN |
| |
_______________________________________________________________________
Figure 11-5. Form22 (Contained in RSI Forms File SAMPLIB)
_____________________________________
| |
| $SET 1 |
| 1 RECORD ALREADY EXISTS |
| 2 RECORD DOES NOT EXIST |
| 3 CUSTOMER INFORMATION FORM|
_____________________________________
Figure 11-6. The Message File
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| HDUMPFILE JF X B B N P1 1 |
| |
| 1 FWORKSTN UP V 90 WORKSTNR B |
| F KFORMS SAMPLIB |
| FCUSTMASTUC F 128R 9AI 1 DISK A |
| F KKEYFL KCUSTMST |
| F* |
| F* SAMPLE RSI PROGRAM USING THE WORK STATION AS A PRIMARY FILE |
| F* |
| |
| 2 IWORKSTN NS 01 1 C1 |
| I* FORM21 |
| I 1 1 FLD1 |
| I 2 100SSN |
| I NS 02 1 C2 |
| I* FORM22 |
| I 1 1 FLD1 |
| I 2 27 NAME |
| I 28 63 ADDR |
| I 64 720ZIP |
| I 73 82 PHONE# |
| I NS |
| 3 ICUSTMASTNS |
| I 1 90SSN |
| I 10 35 NAME |
| I 36 71 ADDR |
| I 72 800ZIP |
| I 81 90 PHONE# |
| |
| C N99 SETON |
| C* CLEAN UP 02 99 |
| 4 C 01 SETOF 808182 |
| C 01 SETOF 656070 |
| C* DETERMINE ACTION REQUESTED |
| 5 C KA SETON 80 ADD RECORD |
| C KB SETON 81 DEL RECORD |
| C KC SETON 82 UPD RECORD |
| C KG SETON LR END JOB |
| C KG GOTO EOF |
| 6 C N01 GOTO EOF |
| C* READ RECORD FROM CUSTOMER MASTER FILE USING SSN AS A KEY |
| C SETOF 42 |
| C SSN CHAINCUSTMAST 42 NO HIT |
| |
| |
___________________________________________________________________________________
Figure 11-7. Processing an RSI Primary File
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| C* SET INDICATORS FOR ERRORS |
| 7 C 80N42 SETON 6070 |
| C N80 42 SETON 6065 |
| C EOF TAG |
| 8 OWORKSTN D 1P |
| O OR 02 |
| O OR 01 60 |
| O OR 01 81 |
| O K6 "FORM21" |
| O 70 6 "0001 1" |
| O 65 6 "0002 1" |
| O** |
| 9 O D 01 80 42 |
| O OR 01 82N42 |
| O K6 "FORM22" |
| O SSN 9 |
| O NAME 35 |
| O ADDR 71 |
| O ZIP 80 |
| O PHONE# 90 |
| O* UPDATE DISK RECORD |
| 10 OCUSTMASTD 02 82 |
| O SSN B 9 |
| O NAME B 35 |
| O ADDR B 71 |
| O ZIP B 80 |
| O PHONE# B 90 |
| O* ADD DISK RECORD |
| O DADD 02 80 |
| O SSN B 9 |
| O NAME B 35 |
| O ADDR B 71 |
| O ZIP B 80 |
| O PHONE# B 90 |
| O* DELETE DISK RECORD |
| O DDEL 01 81N42 |
| O SSN B 9 |
| O NAME B 35 |
| O ADDR B 71 |
| O ZIP B 80 |
| O PHONE# B 90 |
| O* END OF SOURCE STATEMENTS |
| |
| |
___________________________________________________________________________________
Figure 11-7. Processing an RSI Primary File (Continued)
Comments
1 This line and the next one define the RSI file called WORKSTN. It
is a primary file having the forms file name SAMPLIB.
2 This line begins the description of the record identification
codes and input fields for the two RSI forms shown in Figures
11-4 and 11-5.
3 This line begins the description of the input record for the file
CUSTMAST.
4 This line turns off the indicators that are used during each
cycle.
5 This line and the ones which follow, determine the action
requested by the user. The command key indicators are turned OFF
automatically before the form is read from the screen. Only the
first form (FORM21) enabled the command keys. This means that
record-identifying indicators are not necessary for additional
conditioning here. However, user requests are saved using the
general indicators (80, 81 and 82). If the user directs the
program to end, LR is turned ON and control skips to EOF.
6 This and succeeding lines read a record from the file CUSTMAST
only if form FORM21 was just read (the record-identifying
indicator for FORM21 is ON).
7 This line and the next determine if there are any errors. If an
ADD is requested and a record already exists, indicators 60 and
70 are turned ON. If a CHANGE or DELETE action is requested and
the record does not exist, indicators 60 and 65 are turned ON.
Indicators 65 and 70 show the specific error encountered and 60
is used as the override indicator. (See the RPG Utilities
Reference Manual for information about override.)
8 This and succeeding lines define the output for form FORM21.
This form is displayed during the first program cycle (1P): after
form FORM22 is read (indicator 02 is ON) or after an error
(indicators 01 and 60 are ON) is detected or after a DELETE
action (indicators 01 and 81 are ON) is requested. Indicators 65
and 70 determine whether error messages are displayed (RSI
locates the messages in the message file before the form is
displayed).
9 This and succeeding lines define the output for form FORM22.
This form is displayed if the first form is processed without
errors and the user requested an ADD (indicators 01, 42 and 80
are ON) or CHANGE (indicators 01 and 82 are ON and 42 is OFF)
action.
10 This and succeeding lines define the fields that are displayed
for the ADD, CHANGE and DELETE actions. The Blank After Field
(column 39) is used to clear each field before the next cycle
begins.
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| HDUMPFILE JF X B B N P1 1 |
| |
| 1 FWORKSTN UD V 90 WORKSTNR B |
| F KFORMS SAMPLIB |
| FCUSTMASTUC F 128R 9AI 1 DISK A |
| F KKEYFL KCUSTMST |
| F* |
| F* SAMPLE RSI PROGRAM USING THE WORK STATION AS A DEMAND FILE |
| F* |
| |
| 2 IWORKSTN NS 01 1 C1 |
| I* FORM21 |
| I 1 1 FLD1 |
| I 2 100SSN |
| I NS 02 1 C2 |
| I* FORM22 |
| I 1 1 FLD1 |
| I 2 27 NAME |
| I 28 63 ADDR |
| I 64 720ZIP |
| I 73 82 PHONE# |
| I NS |
| 3 ICUSTMASTNS |
| I 1 90SSN |
| I 10 35 NAME |
| I 36 71 ADDR |
| I 72 800ZIP |
| I 81 90 PHONE# |
| |
| C START TAG |
| 4 C SETOF 010242 CLEAN UP |
| C* DISPLAY & READ FIRST FORM |
| 5 C EXCPT FORM21 |
| C READ WORKSTN |
| C* DETERMINE ACTION REQUESTED |
| 6 C KG SETON LR END JOB |
| C KG GOTO EOF |
| C SETOF 808182 |
| C KA SETON 80 ADD RECORD |
| C KB SETON 81 DEL RECORD |
| C KC SETON 82 UPD RECORD |
| C SETOF 606570 |
| 7 C N80N81N82 SETON 60 |
| C 60 GOTO START NO CMD KEY;LOOP|
___________________________________________________________________________________
Figure 11-8. Processing an RSI Demand File
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| C* READ RECORD FROM CUSTOMER MASTER FILE USING SSN AS A KEY |
| 8 C SSN CHAINCUSTMAST 42 |
| C* SET INDICATORS FOR ERRORS; LOOP |
| 9 C 80 N42 SETON 60 70 |
| C N80 42 SETON 60 65 |
| C 60 GOTO START |
| C* DELETE ONLY REQUIRES FIRST FORM, DO IT NOW & LOOP |
| 10 C 81 EXCPT DELREC |
| C 81 GOTO START |
| C* DISPLAY AND READ SECOND FORM |
| 11 C EXCPT FORM22 |
| C READ WORKSTN |
| C* EXECUTE REQUESTED ACTION & LOOP |
| 12 C 82 EXCPT UPDREC |
| C 80 EXCPT ADDREC |
| C GOTO START |
| C EOF TAG |
| |
| 13 OWORKSTN E FORM21 |
| O K6 "FORM21" |
| O 70 6 "0001 1" |
| O 65 6 "0002 1" |
| O** |
| 14 O E FORM22 |
| O K6 "FORM22" |
| O SSN 9 |
| O NAME 35 |
| O ADDR 71 |
| O ZIP 80 |
| O PHONE# 90 |
| O* UPDATE DISK RECORD |
| 15 OCUSTMASTE UPDREC |
| O SSN B 9 |
| O NAME B 35 |
| O ADDR B 71 |
| O ZIP B 80 |
| O PHONE# B 90 |
| O* ADD DISK RECORD |
| O EADD ADDREC |
| O SSN B 9 |
| O NAME B 35 |
| O ADDR B 71 |
| O ZIP B 80 |
| O PHONE# B 90 |
| |
___________________________________________________________________________________
Figure 11-8. Processing an RSI Demand File (Continued)
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| O* DELETE DISK RECORD |
| O EDEL DELREC |
| O SSN B 9 |
| O NAME B 35 |
| O ADDR B 71 |
| O ZIP B 80 |
| O PHONE# B 90 |
| O* END OF SOURCE STATEMENTS |
| |
| |
___________________________________________________________________________________
Figure 11-8. Processing an RSI Demand File (Continued)
Comments
1 This line and the next one define the RSI file called WORKSTN. It
is a demand file having the forms file name SAMPLIB.
2 This line begins the description of the record identification
codes and input fields for the two RSI forms shown in Figures
11-4 and 11-5.
3 This line begins the description of the input record for the file
CUSTMAST.
4 This line turns OFF the record-identifying indicators used for
the demand file because they are not automatically turned OFF by
RPG.
5 This line and the next one display and read the first form
(FORM21) using the EXCPT and READ Calculation Specification
operations. An EXCPT Name is used instead of indicators to
control exception output.
6 This and succeeding lines check the command key indicators to
determine what action was requested. If the user ends input, the
LR indicator is turned ON and control skips to EOF.
7 This line and the next one turn on the RSI override indicator
(60) when no command keys indicators are ON. Control branches to
the beginning (START) of the Calculation Specifications so that
the first form can be redisplayed with override in effect.
Override prevents data already entered on the form from being
erased.
8 This line reads the file CUSTMAST looking for the record whose
key matches the social security number (SSN) entered at the
terminal. If the record is not found, indicator 42 is turned ON.
9 If the action requested was an ADD and the record already exists,
or if the action was CHANGE or DELETE and the record does not
exist, indicator 60 is turned ON. It serves as a general error
indicator and as an RSI override indicator. Indicators 65 and 70
are turned ON for the specific error condition.
If there is an error, control returns to the beginning of the
Calculation Specifications so that FORM21 can be redisplayed with
the appropriate error message and with override in effect.
10 This line and the next one perform the DELETE action using
exception output and an EXCPT name. Once processing is complete
for this action, control skips to the beginning of the
Calculation Specifications (START).
11 This and the next line display and read FORM22 using the EXCPT
and READ operations. The EXCPT Name is used instead of
indicators to control exception output.
12 This line and the next one perform the ADD and CHANGE actions
using exception output and an EXCPT Name. Control then skips to
the beginning of the Calculation Specifications to start the next
cycle.
13 This line and the ones which follow define the output for FORM21.
This form is displayed using exception output with an EXCPT Name;
no additional conditioning is necessary. Indicators 65 and 70
control the error messages. RSI locates the messages in the
message file before the form is displayed.
14 This line and the ones which follow it define the output for form
FORM22. This form is displayed using exception output with an
EXCPT Name; no additional conditioning is necessary.
15 This and succeeding lines define the output for CUSTMAST for each
action. The Blank After Field (column 39) is used to clear each
field before the next cycle begins.
MPE/iX 5.0 Documentation