Using Template Libraries in Place of Individual Template Files

To avoid the need to keep many individual template files, you may create a template library that contains one or more template members. If the MEMBER option is specified on the ROUTINE line in the CSL control file, CSLGEN accesses the specified member of the template library when building the routine.

Within the template library, template members are separated and identified by an identification line. This line is a noncomment line having the keyword TEMPLATE as the first nonblank string on the line. Following the TEMPLATE keyword is a label that identifies the template.

For example, consider the file TEST TEMPLATE, which contains the templates shown in Figure 1.

Figure 1. Example of Template Library (TEST TEMPLATE)
************************************************************
TEMPLATE ALPHA
*
* This is template alpha. The individual data type
* definitions have been offset to improve readability.
*
  OPENVM 8 7            7 parameters, all required
  SBIN    4  INPUT      File_descriptor
  PTR     4  INPUT      Buffer address pointer
   CHAR   *  INOUT      Contents of Buffer
  SBIN    4  INPUT      Buffer_ALET
  SBIN    4  INPUT      Read_count/Write_count
  RTNV    4  OUTPUT     Return_Value
  RTNC    4  OUTPUT     Return_Code
  RTNR    4  OUTPUT     Reason_Code
*
************************************************************
*
TEMPLATE BETA
*
*
  OPENVM 2 2       2 parameter template  2 req parameters
  UBIN   4 INPUT   Handle to String (that had left side
                   appended)
  UBIN   4 INPUT   Handle to String (that had right side
                   appened)
*
*
************************************************************
*
TEMPLATE beta
*
* Since the template search performed by CSLGEN is case
* sensitive the label 'beta' identifies a different
* member than 'BETA'.
*
  OPENVM 3 3       3 parameter template   3 req parameters
  RTNC   4 OUTPUT  Return code
  UBIN   4 INPUT   Handle to String
                   (that had left side appended)
  UBIN   4 INPUT   Handle to String (that had right
                   side appened)
*
***********************************************************
If we want to use the beta template to define the parameter list for a routine called BETA5, we could do so with the following ROUTINE line.
ROUTINE BETA5 BETA5 TEST TEMPLATE A (MEM beta

CSLGEN would retrieve the beta template from TEST TEMPLATE and use it to build BETA5.