Example 2 - Group Data Item, DATE and USE GROUP Directives

If your date information is defined as a group item, you must use both the DATE and USE GROUP directives to map your COBOL numeric data items to SQL date fields. Insert the directives on the line preceding the group item.

       FILE SECTION.
       FD  qa-file.
      $XFD COMMENT  This sample file demonstrates directives.
       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).
               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).
               05  fee                         pic s9(5)v99.
      $XFD DATE=YYYYMMDD
               05  date_paid                   pic 9(8).

The resulting table now has a column with the name of the group item ("last_visit"), which is defined as type DATE/TIME (in Access).

XDBCREFXDPREP06-low.gif