How to add a new KEY to an existing CA Datacom TABLE?
There are a couple of ways to do this via DDUPDATE Utility:
-1- Restore the DATABASE structure to a TEST status and add the KEY occurrence.
If you are not making any other changes, you can copy the TABLE to PROD, otherwise copy the entire DATABASE to PROD.
Once in PROD status you must use the APPLYCXX on the KEY occurrence to update the CXX:
-UPD KEY,parent.key(PROD)
1000 APPLYCXX
-END
-2- If you don't care about history tracking, you can simple add the KEY occurrence to the PROD structure:
-ADD KEY,parent.key(PROD)
1000 APPLYCXX
5000 ...transactions as necessary...
-END
NOTE that transactions are expected in numeric sequence, thus the 1000 APPLYCXX should precede the 5000 transactions.
See CA Datacom Datadictionary Batch Reference 15.0 page 230 for more.
“The 1000 APPLYCXX transaction is used with the -ADD, -DEL, or -UPD header transactions only. The purpose is to apply the delete or add functionality to the CXX. This transaction is limited to KEY occurrences in PROD status. When the 1000 APPLYCXX transaction is provided with a -UPD header transaction, it is assumed that the key has not been defined to the CXX. If the key matches on any of the following attributes in the CXX, it is considered to be a duplicate key and CA Datacom/DB denies it. The 1000 APPLYCXX transaction is required for a -ADD KEY header transaction attempting to add a KEY occurrence in PROD status.”