Previous Topic Next topic Print topic


Code Sample

For your example here, you may want to modify the database table such that instead of the COBOL fields ACCTDO, SNAMEDO1, and FNAMEDO, the database table has the more readable names of ACCOUNT_NUMBER, SURNAME, and FIRST_NAME. To do this, place directives into the COBOL program as follows:

$XFD name=account_number
           02  ACCTDO               PIC X(5).
           02  SNAMEDO.
      $XFD name=surname
               05  SNAMEDO1         PIC X(12).
               05  SNAMEDO2         PIC X(6).
      $XFD name=first_name
           02  FNAMEDO              PIC X(12).
           02  MIDO                 PIC X.
           02  TTLDO                PIC X(4).
           02  TELDO                PIC X(10).
           02  ADDR1DO              PIC X(24).

Saving your file and rebuilding your project generates a new XFD file. When your application performs an OPEN OUTPUT, a new table with the new names is generated. From the perspective of your existing COBOL code, there has been no change. You won’t need to make any changes to your procedure division logic.

Previous Topic Next topic Print topic