Db_access
The db_access utility enables you to modify the VALUE field for any channel in any database, subject to standard database protection mechanisms.
To run Db_access, enter the following at the system prompt:
db_access [qualifiers] [parameters]
In addition to channels, Db_access can also specify fields by using
@fieldname
where fieldname is the name of the field to be modified. For example,
db_access db::chan1@label "test"
writes "test" to the LABEL field of the db::chan1 channel.
Parameters
The db_access command line can include an optional single db_access command. Only single-action commands (those not requiring user input) can be included. The inclusion of db_access commands on the command line facilitates the use of db_access in command procedures. For example,
db_access DB::CHAN_1 5.0
sets the database channel CHAN_1 to the value 5.0 in the database DB.
db_access DB::STRING_CHAN """turn out the lights"""
sets the database channel STRING_CHAN to the value "turn out the lights."
Qualifiers
You can use the following qualifiers, preceded by a "/" or "-" character, with the db_access command:
formatfile
formatfile=<filespec>
Use the formatfile qualifier to specify a file that contains a list of fields to be printed out for the channel. See the appropriate file for your operating system below for an example file that contains all database fields.
WIN c:\vsys\bin\all_fields.dat
LINUX /vsys/bin/all_fields.dat
VMS vsys_root:[exe]all_fields.dat
The order in which the fields are listed becomes the order in which they are shown in db_access. The format file may include text lines enclosed in quotation marks; db_access prints these text lines at the location between fields, as a method for labeling grouped fields.
nooutput
Use the nooutput qualifier to perform a single put to the database without db_access printing anything out. This qualifier is useful in command procedures. For example:
db_access -nooutput demo_db::demo:real_out1 1
Using Db_access Interactively
If no parameters are specified on the command line, you will be prompted for a channel name and an optional channel value. The channel name should be in the form:
<database name>::<channel name>
Note Wildcard characters can be used in the channel name, but they are not allowed in the database name.
|
If no database name is specified, db_access assigns the default database, RT_DATABASE , as the database name. If no channel value is specified after the channel name, Db_access shows the current value of the channel. The display of the value indicates that Db_access was able to find and access the channel successfully. If Db_access is unable to access the channel, it will return to the Db_access prompt to indicate an error in the channel specification; most likely, either the database or the channel was incorrectly specified. Another possible issue is that the database did not contain the specified channel, or that access to the database was denied.
If you provide a value along with the channel name, Db_access puts that value into the channel. The value entered is assumed to be in external units. You can enter integer values in decimal form only.
If the channel carries an array of values, db_access allows you to write values into each place in the array. If you enter an array channel along with a value at the db_access prompt, db_access prompts you with the following message:
Batch Mode {yes, no}?
If you respond yes , all values in the array are overwritten with the supplied value. If you give any other response, db_access prompts you for each array value, one at a time, with the first value entering the array at the lowest position.
Caution If, in the course of entering values, you press the ENTER key without entering a value, the remainder of the array is overwritten with the original value.
|
Example
CACTUS>db_access
Enter channel name ( . to quit )
<channel name> [optional value to be written]
cactusdb::demo:real_in1
DEMO:REAL_IN1
upper_alarm = DEFAULTED
lower_alarm = DEFAULTED
upper_warning = DEFAULTED
lower_warning = DEFAULTED
hi_equip_lim = 0.000000
low_equip_lim = 0.000000
hi_disp_lim = 0.000000
low_disp_lim = 0.000000
convert_slope = 0.000000
convert_offset = 0.000000
format_code = (F8.4)
units_code = volts
delta = 0.000000
size = 1
element external value
[0] -152.432434
---------------------------------
Enter channel name ( . to quit )
<channel name> [optional value to be written]
.
exiting...
Note that because the alarm and warning limits were not defined for the channel when it was created, Vgen inserted the default maximum and minimum values for the defined channel type, as noted by the text DEFAULTED . (For information about Vgen, see Chapter 2 Vgen in your Vsystem Vaccess Concepts Guide.)
|
CACTUS>db_access "demo:real_in1 100"
DEMO:REAL_IN1
upper_alarm = 200.000000
lower_alarm = -200.000000
upper_warning = 80.000000
lower_warning = -80.000000
hi_equip_lim = 0.000000
low_equip_lim = 0.000000
hi_disp_lim = 0.000000
low_disp_lim = 0.000000
convert_slope = 0.000000
convert_offset = 0.000000
format_code = (F8.4)
units_code = volts
delta = 0.000000
size = 1
element external value
[0] 100.000000