Data Definition Language (DDL) Reference Manual

Dictionary Maintenance
Data Definition Language (DDL) Reference Manual529431-004
10-5
Deleting Referenced Objects
Example 10-3 on page 10-5 builds a source file containing the code to open the
dictionary and delete one record. When the DDL compiler compiles the source file, it
opens the dictionary and deletes the record DEPENDENT-INFO from the open
dictionary.
Deleting Referenced Objects
When you delete a constant, a definition, or a SPI token type that is referenced by any
other objects, you must first delete all objects that refer directly or indirectly to the
object you want to delete. You can use the SHOW USE OF statement to determine
whether the object is referenced and by which other objects.
If the object you want to delete is never referenced by another object, use the
technique in Deleting Unreferenced Objects on page 10-4. If the object you want to
delete is referenced, you must first delete the referring objects in an exact sequence.
In Example 10-4 on page 10-5, to delete the constant A, you must first delete definition
B because it refers to A; however, to delete B, you must first delete definition C
because it refers to B. Thus, the sequence of deletions is to delete C, then B, then A.
This ensures that you do not attempt to delete an object referenced by another object.
When an object is referenced by many objects, it is a tedious process to delete all the
objects that refer to it directly and indirectly and to delete them in the correct sequence.
The statement OUTPUT UPDATE
on page 8-7 helps you with this task by performing
the following functions:
It locates all constants, definitions, records, token codes, token types, and token
maps that refer to the object to be deleted.
It writes the DELETE statements to delete the referring objects in the correct
sequence in the first section of an open DDL source file.
It redefines the specified object, in the second section of an open DDL source file.
Example 10-3. Deleting an Unreferenced Object From a Dictionary
42> EDIT delsrc; add
1 ?DICT $data.sales
2 DELETE RECORD dependent-info.
3 //
*EXIT
Remember the period
43> DDL /IN delsrc/
Send listing to your terminal
Example 10-4. Objects That Reference Other Objects
CONSTANT a VALUE IS 1.
DEF b TYPE BINARY VALUE IS a.
DEF c TYPE b.