Using templates

Top  Previous  Next

If you have created a template and defined it to XCICS, the following example shows how you can use the template to create the contents of a document. The following template is created and defined to XCICS with the name ASampleTemplate.

<!--#set var=ASYM value='DFLTUSER'-->
This is an example document which has been created by user
<!--#echo var=ASYM-->.

In the application program, you can define a 48-byte variable called TEMPLATENAME and initialize it to a value of 'ASampleTemplate'. Once again you must define a 16-byte field for the document token (in this example, ATOKEN). You can then issue the command to create the document.

EXEC CICS DOCUMENT CREATE
                  DOCTOKEN(ATOKEN)
                  TEMPLATE(TEMPLATENAME)

This will result in a document being created with the content " This is an example document which has been created by user DFLTUSER.".

To change the symbol to another value, you can issue the DOCUMENT CREATE command with the SYMBOLLIST option:

EXEC CICS DOCUMENT CREATE
                  DOCTOKEN(ATOKEN)
                  TEMPLATE(TEMPLATENAME)
                  SYMBOLLIST('ASYM=Ignazio Ignazi')
                  LISTLENGTH(13)

This will result in a document being created with the content "This is an example document which has been created by user Ignazio Ignazi.".