TEMPLATEFILE(5)           FILE FORMATS            TEMPLATEFILE(5)



NAME
     templatefile - The file containing rules for substitutions.

DESCRIPTION
     This file contains the rules for performing substitutions on
     ascii  text file or ".db" files.  Two formats can exist: one
     specifically for an ascii ".db" file  (usually  produced  by
     GDCT)  and one for a plain ascii text file.  Most tools will
     except either format; the different formats exist  for  con-
     venience.

     The purpose of this file is to specify a  set  of  substitu-
     tions  to  be  performed  on  a  file.  Substitutions can be
     defined in one of two ways.  The general format for  substi-
     tution sets is defined as follows:

     *Version-1*
     { set1var1=sub1, set1var2=sub2,...... }
     { set2var1=sub1, set2var2=sub2,...... }
     { set3var1=sub1, set3var2=sub2,...... }

     - or -

     *Version-2*
     pattern{ var1,var2,var3,....... }
     { sub1_for_set1, sub2_for_set1, sub3_for_set1, ... }
     { sub1_for_set2, sub2_for_set2, sub3_for_set2, ... }
     { sub1_for_set3, sub2_for_set3, sub3_for_set3, ... }

     Each braced line represents an entire variable  substitution
     for  the  input  file.   The  input  file will have each set
     applied to it to produce one composite  file  with  all  the
     completed  substitutions  in  it.   Interpreting  version  1
     should be obvious, for version 2, the variables  are  listed
     in  the "pattern{}" line, which must precede the braced sub-
     stitution lines.  The braced substitution lines contains set
     which  match up with the pattern{} line.  An example will be
     given later.

     For some tools  such  as  subtool(1),  putting  substitution
     rules  into  a file (only one version type allowed per file)
     as above is enough for  the  tool  to  operate.   For  other
     tools, such as dbLoadTemplate(3) which is capable of loading
     records onto an IOC, more information must be given.

     file name.db
     {
          *put version 1 or 2 of substitutions here*
     }

     The keyword file identifies a dbfile(5) to perform the  sub-
     stitutions on, in this case "name.db".



Sun Release 4.1     Last change: 04 Nov 1993                    1






TEMPLATEFILE(5)           FILE FORMATS            TEMPLATEFILE(5)



     To summarize, substitutions can be specified using version 1
     or  2.   The  files can be written in two different flavors:
     one way for an IOC dbfile(5), and one way for a plain  ascii
     text file.

EXAMPLES
     Four simple template file  examples  are  listed  here,  the
     first  two  are  IOC  db  specific, the last two are general
     ones.  All the examples specify the  same  substitutions  to
     perform:  this=sub1  and  that=sub2  for  a  first  set, and
     this=sub3 and that=sub4 for a second set.

     1) file test.db { { this=sub1,that=sub2 } { this=sub3,that=sub4 } }
     2) file test.db { pattern{this,that} {sub1,sub2} {sub3,sub4 } }
     3) { this=sub1, that=sub2 } { this=sub3, that=sub4 }
     4) pattern{this,that} {sub1,sub2} {sub3,sub4 }

     input file for 1 and 2 (see dbfile(5) for examplanation of file):

     database(test)
     {
          record(ai,"$(this)record") { field(DESC,"this = $(this)") }
          record(ai,"$(that)record") { field(DESC,"this = $(that)") }
     }

     input file for 3 and 4:

     The first variable "this" equals $(this), the
     second variable "that" is equal to $(that).

     When 1 and 2 are applied to their  corresponding  file,  two
     sets    of    the   record()   lines   will   be   produced:
     (sub1record,sub2record) and  (sub3record,  sub4record),  see
     dbLoadTemplate(1) for a more thorough explanation.

     When 3 and 4 are applied to their  corresponding  file,  the
     following is produced.

     The first variable "this" equals sub1, the
     second variable "that" is equal to sub2.

     The first variable "this" equals sub3, the
     second variable "that" is equal to sub4.


NOTES
     No special spacing or carriage returns are required in  this
     file.

SEE ALSO
     dbLoadTemplate(1), dbLoadTemplate(3), subtool(1)




Sun Release 4.1     Last change: 04 Nov 1993                    2