Data Definition Language (DDL) Reference Manual
Dictionary Maintenance
Data Definition Language (DDL) Reference Manual—529431-004
10-2
Adding Dictionary Objects
Adding Dictionary Objects
Adding a new dictionary object is usually easier than modifying an existing object
because a new object cannot be referenced by an existing object.
If statements describing new objects refer to previously defined objects in the
dictionary, the dictionary must be open.
When you add a new object, you must be careful that it does not have the same name
as an existing object of the same object type. If it does have the same name, the DDL
compiler replaces the existing object with the new object. If you try to add a new object
that has the same name but is of a different type (for example, a new constant with the
same name as an existing record), the DDL compiler issues an error message and
does not replace the existing object.
You can specify the new object in an interactive DDL session, but errors are not easy
to correct in a session. So if the object requires more than a few lines of code, it is
generally easier and safer to add a new object noninteractively. To add the object, you
specify the appropriate statements in a file, open the dictionary, and compile the file.
To add new objects to the dictionary, do this:
1. Specify the new objects.
2. Use EDIT to create a source file that contains the statements that define the new
objects.
3. Open the dictionary. You can include the DICT or DICTN command to open the
dictionary in the source file, or you can specify it later when you compile the source
file.
4. Compile the source file. You can do this by running the DDL compiler interactively
and using a SOURCE command to specify the source file, or you can use the RUN
DDL command and specify the source file as the IN parameter.
Example 10-1. Generating a schema From a Dictionary
39> DDL
Run the DDL compiler interactively.
!?DICT $data.sales
Open the dictionary.
!?DDL $data.sales.schembak !
Open a DDL source file.
!?OUTPUT *.
Generate DDL source statements from the
dictionary objects and write them to the open DDL
source file (which is now the new schema file).
!EXIT
End the interactive session.