56
v If the field is a character field, the data displayed in the field is returned to your
program as is. A hex 1C is placed at the cursor position and in the remaining
field positions to the right. (Hex 1C appears as an over-scored asterisk on the
display.) The response indicator, if specified, is set on.
v If the field is a numeric field and you specify a response indicator, a hex F0 is
placed at the cursor position and in the remaining field positions. The response
indicator is set on and returned to your program. If a response indicator is not
specified, hex 1Cs are returned to your program.
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.
a.
Specify one field as an input-capable field. For this field, specify DUP with
aresponse indicator. You may want to specify DUP with an option indicator
that is off on the first display of the field. This prevents the work station
user from using the Dup key when the field is first displayed.
b.
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 work station 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 work station 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:
v For numeric fields, a response indicator is required.
v For character fields, a response indicator is optional.
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 for Display Files
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.
Display Files, DUP
220
OS/400 DDS Reference V4R5