PURPOSE: The DUPLICATE option controls automatic duplication of field values when data is being entered or changed in a DS. ENABLE DUPLICATE has the same effect as including the DUPLICATE option in the ENTER or CHANGE command, except that when the DUPLICATE is ENABLEd, it remains in effect until canceled with a DISABLE DUPLICATE command; whereas ENTER…DUPLICATE or CHANGE…DUPLICATE invokes the duplicating feature only for the duration of that command. This command is valid in a CM, PM, SF and as a direct command.
{ENABLE; DISABLE} DUPLICATE [{IF; UNLESS} clause]
ENABLE |
activates the automatic duplicate mode such that the DUPLICATE clause need not be specified in subsequent executions of the ENTER or CHANGE command. |
DISABLE |
suppresses the automatic duplicate mode. This is the default state. If the duplicate mode is desired when using the ENTER or CHANGE command, the DUPLICATE clause must be specified with that command. |
{IF; UNLESS} clause |
specifies certain criteria that must be met for the ENABLE or DISABLE command to take effect. |
The first example that follows illustrates the entry of new customer orders using the automatic duplicate mode and prompts. Prompts are in bold. To invoke duplication you must enter the "=" character rather than a value. The "=" can be changed to another character by entering it in @DUPLICATE.
The second example illustrates the automatic duplicate mode during data entry without requesting prompts. The EXTRACT command shows the duplicated field values.
*ENABLE DUPLICATE
*ENTER WITH PROMPTS
PUB_CODE 1220
PUB_NAME CAJON CORP.
CITY New Orleans
STATE LA
COUNTRY.USA
PUB_CODE 1225
PUB_NAME GULFLAND BOOKS
CITY =
STATE =
COUNTRY.=
PUB_CODE ***
*USE DS PUBLISHERS_DBM2
*STRUCTURE
PUB_CODE,CHAR,4
PUB_NAME,CHAR,40
CITY,CHAR,20
STATE,CHAR,2
COUNTRY,CHAR,20
*ENTER
::7559,DICKSON INC., DETROIT, MI, USA
::7009,MOTOWN BOOKS,=,=,=
::6670,LAKEFRONT PUB., CLEVELAND, OH,=
::***
*EXTRACT
1220 CAJON CORP New Orleans LA USA
1225 GULFLAND BOOKS New Orleans LA USA
7559 DICKSON INC. Detroit MI USA
7009 MOTOWN BOOKS Detroit MI USA
6670 LAKEFRONT PUB Cleveland OH USA
NOTES: When DUPLICATE is invoked for data entry or change, a duplicate field value from the previously entered record is represented by typing an equal sign (=) in the position of the appropriate field. The equal sign is the default value of the system field @DUPLICATE, to which any other one-character value could be assigned.
You can duplicate the value of occurrences within an OCCURS field by, using the <ESC> key. Hence, entering <ESC> to SALES(3) will copy the value of SALES(2) into SALES(3). This feature works even when the DUPLICATE option is disabled.
SEE ALSO: ENTER, CHANGE, OCCURS, and @DUPLICATE