DUP (Duplication) keyword for display files

You 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 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.

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 IBM® i operating system tries to read the display again. The DUP response indicator is still returned to your program in the on condition, even if the workstation user does not type over the DUP characters or presses the Dup key again.

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).