Embedding source files
You can also use entities to embed entire files within your source
file. For example, you could define common variables for several panels
in your source file in a separate file. These separate files are stored
as members of any input library specified to ISPDTLC. Here is markup
that shows the contents of a file called VARDEFS.
<varclass name=titlcls type='char 50'>
<varclass name=bookcls type='char 20'>
<varclass name=pagecls type='char 5'>
<varclass name=datecls type='char 8'>
<varlist>
<vardcl name=title varclass=titlcls>
<vardcl name=author varclass=bookcls>
<vardcl name=publish varclass=bookcls>
<vardcl name=pages varclass=pagecls>
<vardcl name=curdate varclass=datecls>
</varlist>
Another common markup file could be defined for an action bar.
Here is markup that shows a portion of the contents of a file called
ACTNBAR.
<ab>
<abc>File
<pdc>Add Entry
<action run=add>
<pdc>Delete Entry
<action run=delete>
<pdc>Update Entry
<action run=update>
<pdc>Exit
<action run=exit>
<abc>View
⋮
<abc>Options
⋮
<abc>Help
⋮
</ab>
We can embed these files in a source file by coding entity references
to the files in the source file DOCTYPE statement.
<!doctype dm system [
<!entity actnbar system>
<!entity vardefs system>]>
&vardefs;
<panel name=dfdxmp21>Library Inventory
&actnbar;
<topinst>To add a book to the inventory, complete the fields below,
and then press Enter.
<area>
<dtafld datavar=title usage=in pmtwidth=14>Title
<dtafld datavar=author usage=in pmtwidth=14>Author
<dtafld datavar=publish pmtwidth=14>Publisher
<dtafld datavar=pages usage=in pmtwidth=14>Number of pages
<divider type=solid gutter=3>
<dtafld datavar=curdate usage=out pmtwidth=20>Today's date is
</area>
</panel>
The variable definitions in VARDEFS are referred to by the data fields in the panel because the file was embedded into the source file through the entity declaration. In the previous example, the entry width information for each field is obtained from the variable definitions.
File embed entity names must have these characteristics:
- 1-8 characters
- The first character must be alphabetic (A-Z, a-z, @, #, or $)
- Remaining characters, if any, must be A-Z, a-z, @, #, $, or 0-9
- Entity names are case-sensitive.