I use "dbLoad" files such as this one:
#----------------------------------------------------------------------
# HPS937A - LOAD RECORD INSTANCES
#----------------------------------------------------------------------
# Serial Port Number = ${SPN}
# Serial Configuration = 9600 8N1
#----------------------------------------------------------------------
dbLoadRecords("${DB_DIR}/HPS937A.db","deviceName=${IOCNAME}:HPS937A:${SPN}:${PAD},
serialPortNumber=${SPN},primaryAddress=${PAD},
baudRate=${BR},numberOfDataBits=8,parity=0,numberOfStopBits=1");
those can be considered as template for intanciation.
In the stcmd file ( iocsh script ), I source those template files with a
command as follow:
< /DBL_DIR/HPS937A.dbl
Now, before I source this file, I need to epicsSetEnv all the variables
such as ${SPN} and ${PAD} and ${IOCNAME}. ( or they need to be defined
in the linux shell )
Now, I would like to include in my dbl files a command that says:
If this variable is not set, then set it to this value.
This would enable me to just set the vars that are meaningful.
For example, baudRate could default to 9600. But if I really want to
change it I can do so with epicsSetEnv(BR,19200).