HIDDEN directive

The HIDDEN directive allows you to hide specific data items from end users, while providing normal access to other data items. When you place this directive immediately before a data item in an FD, that item is hidden from end users. Field names affected by the HIDDEN directive are literally not placed into the system catalog. The user can neither read, modify, nor even know that this field exists.

Note: An alternative is to create a VIEW of the table that does not include the field. To do so, use the CREATE VIEW command.

The HIDDEN directive applies to only the elementary data item it precedes. Subsequent data items revert to normal read access. Note that you cannot apply the HIDDEN directive to group items and you cannot hide the key.

If you use the INSERT command on a table that has hidden fields, spaces (hex value 20) are put into the hidden fields, whether they are numeric or alphanumeric.

Syntax

$XFD HIDDEN

In the following FD, "fee" is hidden from users in the resulting table.

       FILE SECTION.
       FD  jr-file.
      $XFD COMMENT  This sample file demonstrates directives.
       01  jr-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).
               05  owner                       pic x(30). 
           03  financial.
               05  acct_no.
                   10  year                    pic x(2).
                   10  seq_no                  pic x(4).
      $XFD DATE=YYYYMMDD, USE GROUP
               05  last_visit.
                   10  yyyy                    pic 9(4).
                   10  mm                      pic 9(2).
                   10  dd                      pic 9(2).
      $XFD HIDDEN
               05  fee                         pic s9(5)v99.
      $XFD DATE=YYYYMMDD
               05  date_paid                   pic 9(8).

Note that in the resulting table, the "fee" column no longer appears:

XDBCREFERENCES0001-low.gif

This directive is useful for hiding data like passwords, telephone numbers, and financial information — whatever information you don't want users to see.

You cannot include a HIDDEN field in a WHEN directive with a TABLENAME clause, because of the complexities of editing or adding records. In this situation, you must add the data, but since the field is hidden, you cannot see it and could add a value that would cause unexpected results.