Using RSI CONSOLE Files [ HP RPG/iX Reference Manual ] MPE/iX 5.0 Documentation
HP RPG/iX Reference Manual
Using RSI CONSOLE Files
A CONSOLE file is a special RSI file that you can use for simple data
collection applications, such as entering timecard data.
When you use a CONSOLE file, the compiler uses SIGEDITOR to generate a
forms file from the CONSOLE file's Input Specifications.
Since CONSOLE files are used for input only, do not enter Output
Specifications for them. At run time, RPG performs all of the input and
output for CONSOLE files.
To use an RSI CONSOLE file in an RPG program, perform the following steps
(each step is described in the following sections of this chapter):
1. Define the RSI CONSOLE file using File Description and Input
Specifications.
2. If necessary, enter Calculation Specifications to perform
auxiliary processing for the RSI CONSOLE file. For example, you
may want to print the data on the screen.
Entering File Description and Input Specifications
To use an RSI CONSOLE file in a program, you must define it in a File
Description Specification as a WORKSTNC file (the Device Class Name Field
(columns 40-46) is WORKSTN and the Interface Type Field (column 47) is
C).
Table 11-4 describes the fields in the File Description and Input
Specifications that relate to an RSI CONSOLE forms file. The fields that
are optional are followed by an asterisk (*).
Table 11-4. RSI CONSOLE File Description and Input Specifications
-----------------------------------------------------------------------------------------------
| | | |
| Specification | Field | Value |
| Type | | |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| File Description | File Name | The name of the RSI CONSOLE file. |
| (F) | (columns 7-14) | |
| | | |
| | File Type | I (input). |
| | (column 15) | |
| | | |
| | File Designation | P (primary) or D (demand). |
| | (column 16) | |
| | | |
| | Record Format | V (variable-length records). |
| | (column 19) | |
| | | |
| | Logical Record Length | The length of the longest record defined in |
| | (columns 24-27) | the Input Specifications. |
| | | |
| | Device Class Name | WORKSTN. |
| | (columns 40-46) | |
| | | |
| | Interface Type | C (RSI CONSOLE file). |
| | (column 47) | |
| | | |
| | Interface Control* | B (enable) or blank (disable) the BREAK |
| | (column 52) | key. |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| Input (I) | | |
| | | |
| (File and Record | File Name | The name associated with the WORKSTNC |
| Description line) | (columns 7-14) | device. |
| | | |
| | OR* | OR if more than one record type uses all of |
| | (columns 14-15) | the same fields. This line must contain |
| | | the same number of record identification |
| | | codes (in the Record Identification Code |
| | | Fields, columns 23-34) as the line it |
| | | follows. |
| | | |
| | Group Sequence* | A numeric entry for sequence checking or an |
| | (columns 15-16) | alphabetic entry for no sequence checking. |
| | | |
| | Number of Records* | Blank if the Group Sequence Field (columns |
| | (column 17) | 15-16) is alphabetic; 1 if this is the only |
| | | record for this record type and N if there |
| | | is more than one record for this record |
| | | type. |
| | | |
-----------------------------------------------------------------------------------------------
Table 11-4. RSI CONSOLE File Description and Input Specifications (cont.)
-----------------------------------------------------------------------------------------------
| | | |
| Specification | Field | Value |
| Type | | |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| Input (I) | | |
| | | |
| (File and Record | Option* | Blank if the Group Sequence Field is |
| Description line) | (column 18) | alphabetic; 0 if the record type is |
| | | optional. |
| | | |
| | Record Indicator | The record-identifying indicator that |
| | (columns 19-20) | identifies the form. It must be in the |
| | | range 01-10 and cannot be used with more |
| | | than one record type in the program. (You |
| | | can have up to 10 record types in the |
| | | program.) |
| | | |
| | Record Identification | The record identification codes that |
| | Codes | identify the form. |
| | | |
| | (columns 21-24) | 1 (The record identification code must |
| | | begin in the first position of the record.) |
| | | |
| | (column 26) | C (Use the entire character for the record |
| | | identification code.) |
| | | |
| | (column 27) | A character that identifies this record |
| | | type. |
| | | |
| | (columns 28-34)* | Contains a second record identification |
| | | code for the record type. Enter |
| | | information into these columns the same way |
| | | you did in columns 21-27, except enter 2 in |
| | | column 31. |
| | | |
| (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) The maximum |
| | | field length is 66 for alphanumeric fields |
| | | and 15 digits for numeric fields. |
| | | |
| | Decimal Positions | A digit that specifies the number of |
| | (column 52) | decimal positions in a numeric field. |
| | | |
| | Field Name | The name of the field. Use a descriptive |
| | (columns 53-58) | name since it is used as the input prompt. |
| | | |
| | Field Record Relation* | The field record relation indicator. |
| | (columns 63-64) | |
| | | |
| | Field Indicators* | The field indicators. |
| | (columns 65-70) | |
| | | |
-----------------------------------------------------------------------------------------------
Example
Figure 11-9 shows how to define an RSI CONSOLE file. Line 1 defines
the file SCRNFL as an RSI WORKSTNC file. The lines beginning with line 2
define the fields in SCRNFL.
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| 1 FSCRNFL IP V 48 WORKSTNC B |
| |
| 2 ISCRNFL NS 01 1 CT 2 CC |
| I 1 2 RECID |
| I 3 8 WEDATE |
| I 9 140EMPNUM |
| I 15 182PYRATE |
| I 19 22 ACCTCD |
| I 23 261TOTHRS |
| I 27 291MONHRS |
| I 30 321TUEHRS |
| I 33 351WEDHRS |
| I 36 381THUHRS |
| I 39 411FRIHRS |
| I 42 441SATHRS |
| I 45 471SUNHRS |
| |
| |
___________________________________________________________________________________
Figure 11-9. Entering RSI CONSOLE File Description and Input Specifications
Entering Calculation Specifications
You may include Calculation Specifications to condition operations
related to a CONSOLE file. For example, Figure 11-10 shows an ADD
operation that counts the number of transactions (screens of data)
entered by the data entry operator (user).
Do not condition Calculation Specifications with command key indicators
(you cannot use command key indicators with RSI CONSOLE files).
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| C ADD 1 COUNT |
| |
| |
___________________________________________________________________________________
Figure 11-10. Entering an RSI CONSOLE Calculation Specification
Compiling an RSI CONSOLE Program
When you compile a program containing an RSI CONSOLE file for the first
time, use the GEN option of the $CONTROL compiler subsystem command (or
omit the NOGEN option). GEN directs the compiler to generate a forms
file for the CONSOLE file. You can tailor this forms file using
SIGEDITOR, if necessary (for information on this see the next paragraph).
Once the program is debugged, use the NOGEN option of $CONTROL for
subsequent compilations. NOGEN directs the compiler not to generate a
new forms file.
If you use SIGEDITOR to tailor the form, be careful not to change the top
(status) line of the form. In addition, do not change any constants or
alter the size or order of the fields. See the RPG Utilities Reference
Manual for instructions on how to use SIGEDITOR to modify the forms file.
Once your form is customized and is formatted properly, be sure to
compile the program using the NOGEN parameter of the $CONTROL compiler
subsystem command; otherwise the customized forms file will be
overwritten.
Whenever you change the Input Specifications for a CONSOLE file, you must
recompile the program with the GEN parameter (or omit NOGEN) to generate
a new forms file.
Executing an RSI CONSOLE Program
When a program that uses CONSOLE files is executed, the data entry
operator (user) selects the form to display by pressing one of 10 command
keys. They are the unshifted keys 1-0 and = on the top row of the
keyboard as shown in Figure 11-11 .
Figure 11-11. RSI CONSOLE Command Keys
When the user presses a command key, the form whose record indicator
matches the command key is displayed. For example, if you use record
indicator 3 with a form, the user displays it by pressing f1 followed by
3. Table 11-5 lists the command keys along with their descriptions.
Table 11-5. How to Use RSI CONSOLE Command Keys
--------------------------------------------------------------------------------------------
| | |
| COMMAND (f1) | Performs this action: |
| followed by: | |
| | |
--------------------------------------------------------------------------------------------
| | |
| 1 | Displays the record type whose record indicator is 1. |
| 2 | Displays the record type whose record indicator is 2. |
| 3 | Displays the record type whose record indicator is 3. |
| 4 | Displays the record type whose record indicator is 4. |
| 5 | Displays the record type whose record indicator is 5. |
| 6 | Displays the record type whose record indicator is 6. |
| 7 | Displays the record type whose record indicator is 7. |
| 8 | Displays the record type whose record indicator is 8. |
| 9 | Displays the record type whose record indicator is 9. |
| 0 | Displays the record type whose record indicator is 10. |
| = | Ends the program. |
| | |
--------------------------------------------------------------------------------------------
NOTE The command keys shown in Table 11-5 are supported on 239x and
262x terminals. 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.
Sample RSI CONSOLE Program
The sample program in this section shows how to use an RSI CONSOLE file
to collect weekly payroll information. For each field in the file, the
user is prompted to enter the corresponding piece of data. The program
writes the payroll data to a disk file for later processing. Figure
11-12 shows what the CONSOLE file fields look like when displayed on
the screen. The program itself is shown in Figure 11-13 .
______________________________________________________________________
| |
| TC 01 1 1 |
| WEDATE A 6 ______ |
| EMPNUM N 6.0 _______ |
| PYRATE N 4.2 _____ |
| ACCTCD A 4 ____ |
| TOTHRS N 4.1 _____ |
| MONHRS N 3.1 ____ |
| TUEHRS N 3.1 ____ |
| WEDHRS N 3.1 ____ |
| THUHRS N 3.1 ____ |
| FRIHRS N 3.1 ____ |
| SATHRS N 3.1 ____ |
| SUNHRS N 3.1 ____ |
| |
| |
| |
| |
| |
| |
| COMMAND *PRINT f3 f4 f5 f6 f7 f8 |
| SCREEN |
| |
______________________________________________________________________
Figure 11-12. An RSI CONSOLE Form
The top line of the display in Figure 11-12 is the status line. TC
is the record identification code entered in columns 24-34 of the Input
Specification that defines the record type. The second field in the
status line is the record-identifying indicator (01) for the record type.
The third and fourth fields in the status line indicate the other record
types that can be selected before and after the user enters data in the
form. (In this example, only one record type is defined, so 1 appears in
both places.)
The rest of the screen shows the fields defined in the Input
Specifications for the record type. The following information is
displayed for each field: field name, data format (A=Alpha, N=Numeric),
field length, the implied decimal position (for numeric fields) and an
underscored area that shows where to enter data. As data entry is
completed for each screen, the user presses ENTER. The user presses
command key 12 (= key) to end the program.
___________________________________________________________________________________
| |
| 1 2 3 4 5 6 7 |
| 678901234567890123456789012345678901234567890123456789012345678901234|
| _______________________________________________________ |
| |
| 1 $CONTROL NAME=TIMECD,GEN |
| HDUMPFILE JF X B B N P1 1 |
| |
| F* |
| F* SAMPLE CONSOLE FILE PROGRAM - TIMECARD DATA ENTRY |
| F* |
| 2 FSCRNFL IP V 48 WORKSTNC B |
| FOUTPUT O F 48 DISK |
| |
| 3 ISCRNFL NS 01 1 CT 2 CC |
| 4 I 1 2 RECID |
| I 3 8 WEDATE |
| I 9 140EMPNUM |
| I 15 182PYRATE |
| I 19 22 ACCTCD |
| I 23 261TOTHRS |
| I 27 291MONHRS |
| I 30 321TUEHRS |
| I 33 351WEDHRS |
| I 36 381THUHRS |
| I 39 411FRIHRS |
| I 42 441SATHRS |
| I 45 471SUNHRS |
| |
| C* |
| 5 C* NO CALCULATION SPECIFICATIONS REQUIRED |
| C* |
| |
| 6 OOUTPUT D 01 |
| O RECID 2 |
| O WEDATE 8 |
| O EMPNUM 14 |
| O PYRATE 18 |
| O ACCTCD 22 |
| O TOTHRS 26 |
| O MONHRS 29 |
| O TUEHRS 32 |
| O WEDHRS 35 |
| O THUHRS 38 |
| O FRIHRS 41 |
| O SATHRS 44 |
| O SUNHRS 47 |
| |
| |
___________________________________________________________________________________
Figure 11-13. Processing an RSI CONSOLE File
Comments
1 This subsystem command gives the program name and directs RPG to
generate an RSI forms file from the Input Specifications.
The forms file name is TIMECDFM which is the program name with an
FM appended. (You can also enter the program name in the Program
Name Field (columns 75-80) of the Header Specification.)
2 This line defines the CONSOLE file SCRNFL. It is an input primary
file with a record length of 48.
3 This line defines the record type TC for the CONSOLE file. The
form name for this record type is FORM01 (RPG assigns the name
FORM and the record-identifying indicator is 01).
4 This and succeeding lines define the fields for record type 01.
5 This program has no Calculation Specifications.
6 These lines describe the output file to which the payroll data is
written. Enter Output Specifications just as you would in any
other RPG program.
MPE/iX 5.0 Documentation