Embedded template commands

The CICS document handler recognizes three commands that can be embedded in a document template. The three commands that are supported are #set, #echo and #include.

Syntax for embedded template commands

Embedded template commands follow the syntax rules for Server Side Include commands. A Server Side Include command starts with the characters left angle bracket, exclamation mark, hyphen, hyphen, number sign (hash), followed by the command. It is terminated with the characters hyphen, hyphen, right angle bracket. For example:
<!--#command-->

The characters used to start and end the Server Side Include must be in code page 037, otherwise the command is ignored. The hexadecimal equivalents for these character sequences are X'4C5A60607B' and X'60606E'.

#echo command

The #echo command identifies a symbol that must be substituted when the template is inserted into the document. For example, this #echo command identifies the symbol ASYM to be substituted into a document at the location of the command:
This is the <!--#echo var=ASYM--> symbol.

When the template is used, the string containing the #echo command is completely replaced by the value defined for the symbol. If no symbol definition has been provided with that name, the #echo command remains in the output data. The value for the symbol can be defined by an application program, or as a default value by a #set command in the template.

#set command

The #set command is used to set the values of symbols. It is useful for setting up default values for symbols. For example, this #set command specifies a default value of 'first' for the symbol ASYM:
<!--#set var=ASYM value='first'-->

A #set commands can override another #set command. If you include more than one #set command in the template for the same symbol name, the last command is used.

A #set command in the template is ignored if the symbol to which it applies has already been given a value using the DOCUMENT SET command. A symbol which has been assigned a value using the DOCUMENT SET command can only be changed by issuing another DOCUMENT SET command.

The #set command can be used in combination with the #echo command, or it can apply to a symbol reference that has been specified by preceding the symbol name with an ampersand (&) and terminating it with a semicolon (;).

#include command

The #include command allows a template to be embedded within another template. Up to 32 levels of embedding are allowed.

For example:
<!--#include template=
templatename-->
templatename is the name of the template (the 48 byte name) defined in the DOCTEMPLATE resource definition. The template name can also be enclosed in double quotes.


dfhp3_doc_embedded.html | Timestamp icon Last updated: Monday, 5 June 2017