


The AcuODBC READ-ONLY directive allows you to make some fields, or columns, of data read-only, while preserving normal access to other fields or columns. When placed immediately before a data item in an FD, this directive assigns the read-only attribute to the item. The read-only attribute applies only to the next data item with a picture clause and not to group items. Subsequent data items return to normal read-write access.x
$XFD COMMENT ACUODBC READ-ONLY
or
*(( XFD COMMENT ACUODBC READ-ONLY ))
In the code creating the "animals" table, the "owner" data item has been designated as read-only. The code is:
FILE SECTION.
FD qa-file.
01 qa-record.
03 animal-info.
05 patient-id pic x(5).
05 atype pic x.
05 ctype redefines atype pic x.
05 dtype redefines atype pic x.
05 otype redefines atype pic x.
03 owner-info.
05 phone pic x(8).
*(( XFD COMMENT ACUODBC READ-ONLY ))
05 owner pic x(30).
03 financial.
05 acct_no.
10 year pic x(2).
10 seq_no pic x(4).
05 last_visit.
10 mm pic 9(2).
10 dd pic 9(2).
10 yyyy pic 9(4).
$XFD COMMENT ACUODBC HIDDEN
05 fee pic s9(5)v99.
05 date_paid pic 9(8).
In the database table, the "owner" column looks the same as the other column. However, if the data is linked and users attempt to make changes to any of the items in that column, they receive a message telling them that the update on a linked table failed.
If you add this directive to the FD, you should use the xfdcrypt utility included with AcuODBC to encrypt your data dictionaries. Otherwise, users can edit the ".xfd" file to gain access to the read-only fields. See section 6.4, "Encrypting XFD Files", for more information.
Making Entire Tables Read-Only
To make an entire table read-only, you can embed the following statement below the top-level description (containing group item) of the table in the FD. This directive must be placed before the data item that you want mapped to a column in the table.
$XFD COMMENT ACUODBC READ-ONLY TABLE
or
*(( XFD COMMENT ACUODBC READ-ONLY TABLE ))
For example:
01 qa_record.
$XFD COMMENT ACUODBC READ-ONLY TABLE
03 animal_info.
An exception to the placement of AcuODBC READ-ONLY TABLE directive occurs when the containing group item has another $XFD COMMENT directive associated with it. In such instances, insert the AcuODBC READ-ONLY TABLE directive before the next line (data item) that does not have an $XFD COMMENT associated with it.