DDS for display files


DUP (Duplication) keyword for display files

Use this field-level keyword to activate the Dup key on the display station keyboard. Press the Dup key when the cursor is in this input-capable field. This indicates that data for this field is to be duplicated from the record sent in the previous input operation. The actual duplication is the responsibility of your program (see Programming for the Dup key later in this section).

Refer to Appendix B, System/36 environment considerations for display files, for special considerations when specifying the DUP keyword in files that are used in the System/36 environment.

The format of the keyword is:

DUP[(response-indicator ['text'])]

You cannot specify the DUP keyword on a floating-point field (F in position 35).

You should specify a response indicator for a numeric field defined with this keyword. Hex 1Cs for numeric fields will not be returned to your buffer, but hex F0s will be returned for the remaining field positions.

Option indicators are valid for this keyword.

Programming for the Dup key:

When you press the Dup key, the OS/400 program handles the field as follows:

In your program, you can duplicate entire fields (either character or numeric) with the following procedure:

  1. Specify, in DDS, two fields for each input-capable field on the display.
    1. Specify one field as an input-capable field. For this field, specify DUP with a response indicator. You may want to specify DUP with an option indicator that is off on the first display of the field. This prevents the workstation user from using the Dup key when the field is first displayed.
    2. Specify the other field as a hidden field (H in position 38).
  2. On the first output operation, set off an option indicator for DUP. This prevents the workstation user from using the Dup key.
  3. On the first input operation, move the input-capable field to the hidden field. This saves the keyed value for later use.
  4. On each subsequent output operation, set the option indicator on for the DUP keyword. This allows the workstation user to use the Dup key.
  5. On each subsequent input operation, test the response indicator specified with DUP. If the response indicator is off, the input data should be moved to the hidden field. If the response indicator is on, you can use the existing value in the hidden field.
    Note:
    When using the DUP keyword in a subfile, an update operation should be performed after steps 3 and 5 to store the value of the hidden field into the subfile. This will be returned on the next read of that subfile record.
  6. Repeat steps 4 and 5 for subsequent data entry using the Dup key.

You can also duplicate character fields one character at a time by saving them in arrays, then moving the array one character at a time and checking for the DUP key indication of hex 1C.

You can achieve duplication of numeric fields one digit at a time by defining the field as character and eventually moving it to your numeric field after the hex 1Cs have been removed. You can test whether the Dup key has been pressed:

The field will contain hex 1C at the cursor position and in the remaining positions if the Dup key has been pressed.

Restrictions on validity checking:

Validity checking keywords (CHECK, COMP, RANGE, and VALUES) can be specified with the DUP keyword. However, they have no effect if the Dup key has been pressed.

If another field in the record format fails validity checking, the OS/400 program tries to read the display again. Whether or not the workstation user keys over the DUP characters or presses the Dup key again, the DUP response indicator is still returned to your program in the on condition.

Example:

The following example shows how to specify the DUP keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RECORD1
00020A            FLDA           5   I  3  2
00030A  15                                  DUP(16 'FLDA was duped')
00040A            FLDAH          5  2H
     A

FLDA is an input-capable character and hexadecimal field for which the workstation user can press the Dup key. In your program, you must test the data in FLDA to ensure that it includes only the digits 0 through 9. In RPG III, you can use the TESTN operation code. In COBOL, you can use a numeric class test. In BASIC, you can specify an ON CONV statement earlier in the program than the statement with which you assign FLDA to FLDAH. In PL/I, you can specify an ON statement with the ERROR condition earlier in the program than the statement with which you assign FLDA to FLDAH.

Field FLDAH is a hidden numeric field with the same length as FLDA. When the application program reads RECORD1 and finds response indicator 16 set off, the program moves FLDA to FLDAH and uses FLDAH (which is a numeric field). When the application program reads RECORD1 and finds response indicator 16 set on, the Dup key was pressed and FLDA contains hex 1Cs. The program uses FLDAH without changing its contents (which are the contents from the previous input received from the display device).


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]