/*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE Versions 3.13.7 * and higher are distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/
dbLoadRecords, dbLoadTemplate - load ascii database records into an IOC
dbLoadRecords(char* db_file, char* substitutions) dbLoadTemplate(char* template_file)
These routines are available from IOC core on the vxWorks command line. Both provide a way to load ascii ".db" files (usually created by gdct(1) ) into the IOC. The ".db" files contain ascii versions of record instances and are described in more detail in dbfile(5). In addition to loading the ".db" ascii files into the IOC, both routines provide a method of performing variable substitution on record names and field values. dbLoadRecords() reads the ".db" file db_file performing sub- stitutions specified in string substitutions. The substitu- tion must be a string specified as follows: "var1=sub1,var2=sub3,..." Variables are specified in the ".db" file as $(variable_name). If the substitution string "a=1,b=2,c=\"this is a test\"" were used, any variables $(a), $(b), or $(c) would be substituted with the appropri- ate data. See the EXAMPLES section for more details. dbLoadTemplate() will read a template_file. The template_file resides in the your IOC boot directory and contains rules about loading ".db" files and performing sub- stitutions. The template_file must be in the form used by an IOC and is described in templatefile(5). The EXAMPLES section descibes how it can be used.
The next two examples of dbLoadRecords() and dbLoadTem- plate() will use the following ".db" file named test.db : database(test) { record(ai,"$(pre)testrec1") record(ai,"$(pre)testrec2") record(stringout,"$(pre)testrec3") { field(VAL,"$(STRING)") field(SCAN,"$(SCAN)") } } Running dbLoadRecords ("test.db","pre=TEST,STRING=\"this is a test\",SCAN=Passive") will produce the following records in the IOC's database: TESTtestrec1 TESTtestrec2 TESTtestrec3 The third record will have VAL set to "this is a test" and SCAN set to "Passive". Running dbLoadTemplate ("test.template") with test.template containing: file test.db { {pre=TEST1, STRING = "this is a test two", SCAN="1 Second" } {pre=TEST2, STRING = "this is a test one", SCAN=Passive } {pre=TEST3, STRING = "this is a test three", SCAN=Passive } } will produce a total of nine records in the IOC's database: TEST1testrec1 TEST1testrec2 TEST1testrec3 - (VAL="this is a test two", SCAN="1 Second") TEST2testrec1 TEST2testrec2 TEST2testrec3 - (VAL="this is a test one", SCAN="Passive") TEST3testrec1 TEST3testrec2 TEST3testrec3 - (VAL="this is a test three", SCAN="Passive")
The binary file default.dctsdr must be loaded prior to run- ning either of these routines. This file contains the rules on how to construct records and change field values. After the default.dctsdr file is loaded, these routines can be run as many times as desired until iocInit is run.
gdct(1), templatefile(5), dbfile(5)