In addition to describing the directives you can include in your COBOL file's FD section, this section provides sample code and examples based on the sample files, animals.cbl and file_dir.cbl, that come with AcuXDBC. (These files are located with the other files that make up the AcuXDBC installation.)
The files were compiled with the following command:
ccbl32 -fa animals.cbl
After successful compilation, the Vision file was created with the following command:
The tables resulting from these files are displayed in Microsoft Access 2000. See Working with Windows and Java Applications for information on bringing external data into the database.
The following code is the FD for the source animals.cbl file. Note that this is a highly simplified example intended only to demonstrate the use of directives. You would not insert data into a table with this design.
FILE SECTION. FD jr-file. 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). 05 last_visit. 10 yyyy pic 9(4). 10 mm pic 9(2). 10 dd pic 9(2). 05 fee pic s9(5)v99. 05 date_paid pic 9(8).
With each directive, a new line is added to the code. Examples in each directive description (follow the links in the table below) show the code and also the resulting database table, where appropriate. If you are working on a different system, you may use different commands to compile animals.cbl and to create the COBOL file. If you are using an application other than Microsoft Access 2000, the resulting tables may appear different.
The following figure illustrates a table that was imported into Microsoft Access 2000 based on the FD above. You may want to note the changes to this table as directives are added to the FD in the directive descriptions.
The file file_dir.cbl is used only when describing the FILE directive. The sample source code is shown in the topic FILE directive.