Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Daniel7 Absent Member.
Absent Member.

AcuXDBC, $XFD entries in FD

Following Problem with compile XFD-compileable COBOL program. I have got following code sequence in a FD.

      216 $XFD COMMENT Adressenstamm
      217 $XFD FILE=SADF
      219 FD      SADF
      220         LABEL RECORD OMITTED
      221         DATA RECORD IS SADR.
      224 78        SAD-KN-RECLEN                           VALUE 10000.
      226 01      SADR.
      228         02 SAD-TA.
      229 *               -- Firmennummer
      230                 03 SAD-KY                         PIC 9(4).
      232 *               -- Key 0 (Primary Key)
      233                 03 SAD-TAKY0.
      234 *                       -- Adressennummer
      235                         04 SAD-KYKD               PIC X(9).
      236 *                       -- Adressennummer komplett wg/acu-xdbc
      237                         04 SAD-RDKYKD REDEFINES SAD-KYKD.
      238 *                               -- Adressenart (1=Debitor, 2=Kreditor
      239                                 05 SAD-KZKYKD     PIC 9.
      240 *                               -- Laufende Nummer der Adresse
      241                                 05 SAD-KDKYKD     PIC X(8).

Program is prepared for compile with AcuXDBC Options. After compile program I get this warning message from Acucobol Compiler:

line 198: Warning: Field SAD-KZKYKD causes duplicate database data

Have anyone an idea about this message?

Tags (3)
4 Replies
Daniel7 Absent Member.
Absent Member.

RE: AcuXDBC, $XFD entries in FD

An Addition of my question. XDBC table is generated with both fields, SAD-KYKD and SAD-KZKYKD, but the second is a redefination of first field. Normally it generates table fields from non-redefination fields (like SAD-KYKD). Redefined fields (like SAD-KYKD) are not respect by XDBC.

But these are key fields. I've got a notation there are differences in generating of XFD fields from COBOL between key fields an normal data fields.

Have anyone an idea about? Thanks.

Micro Focus Expert
Micro Focus Expert

RE: AcuXDBC, $XFD entries in FD

Fields contained in a redefining item occupy the same positions as the fields being redefined. The compiler needs to select only one of the field definitions to use. The default rule that it follows is to use the fields in the item being redefined as column names. Take a look at the WHEN directive for XFDs.

Micro Focus Expert
Micro Focus Expert

RE: AcuXDBC, $XFD entries in FD

The WHEN directive should allow you to use both names even though they occupy the same place within the COBOL data file.

Chuck Edgin Absent Member.
Absent Member.

RE: AcuXDBC, $XFD entries in FD

You are correct that when you have a redefined field, only the first field (the one being redefined by the second) will be included as a column in the XFD - except for when the second one (or part of it) is declared as a KEY field. All KEY fields must be included as columns, so now we have the same data being added twice and thus the duplicate data warning.

Assuming the following SELECT:

       select sadf assign to disk
           organization is indexed
           record key is sad-ky
           alternate key is sad-kykd
           alternate key is sad-kzkykd.

and this part of the FD:

           03 SAD-KY PIC 9(4).
           03 SAD-TAKY0.
      *        -- This field will be included because it's the one 
      *        -- being redefined (AND because it's a key field)
               04 SAD-KYKD PIC X(9).
      *            -- This field must be included because it's a key 
      *            -- field (but the data has already been included 
      *            -- above, thus causing the duplicate data warning)
                   05 SAD-KZKYKD PIC 9.
                   05 SAD-KDKYKD PIC X(8).

The duplicate data warning is just that - a warning. If you are going to update data through AcuXDBC, you will need to make sure that the duplicated areas contain the same values. If not... I'm not sure what the result will be, but my guess is that one or the other will take precedence and the other will be ignored. Or, it may cause an error of some sort.

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.