TEMPLATEFILE(5)

NAME
templatefile - The file containing rules for substitutions.

DESCRIPTION

This file contains the rules for performing substitutions on ".db" files.

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

*Version-1*
file name.db {
    { set1var1=sub1, set1var2=sub2,...... }
    { set2var1=sub1, set2var2=sub2,...... }
    { set3var1=sub1, set3var2=sub2,...... }
}
.
.
.
- or -
*Version-2*
file name.db {
    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 substitution lines. The braced substitution lines contains set which match up with the pattern{} line. An example will be given later.

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

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 } }
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)") }
}
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.

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

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