This chapter explains what XFD directives are and how you can use them in your COBOL File Descriptors (FDs) to control how your database tables are built.
EXtended File Descriptors (XFDs) are based on your COBOL File Descriptors (FDs). For this reason we call them extended FDs or XFDs. Each XFD describes all of the fields for one file.
XFD directives are optional comments that you can use in your FDs to control how things look on the database side. Many applications will use only the CREATEXFD directive. XFD directives are most commonly used when a site intends to do a lot of work with the relational database management system (RDBMS) outside of the COBOL application, and wants to control how the database table is built.
XFD directives are special comments placed into an FD in your COBOL source code. They guide the building of the XFDs, which in turn guide the building of the database table.
Each XFD directive includes the letters "XFD". These three letters indicate to the Compiler that the comment is to be used in XFD generation.
XFD directives offer you a great deal of control over how the database table is built. Among other things, they enable you to:
XFD directives are always placed within a COBOL FD. They do not affect Procedure Division I/O statements, and they do not change your COBOL fields in any way. Rather, they guide the building of the XFDs, giving you a measure of control over the way COBOL data is mapped to database fields.
You can build XFDs directly from your source code with only the CREATEXFD directive if the default mapping rules described in the chapters XFDs and New and Existing Databases are sufficient for your situation. If you would like to override the default mapping behavior or map a field to a different name, you must add additional XFD directives to your COBOL code.
Place each XFD directive syntax on a line by itself, immediately before the COBOL line to which it pertains.
Introduce each XFD directive with a "$" in the Indicator Area (column 7 in standard ANSI source format), followed immediately by the letters "XFD", and then the XFD directive itself. There should be no space between the $ and the XFD. Spaces are permitted elsewhere on the line as separators. For example, the NAME XFD directive looks like this:
$XFD NAME = EMP-NUMBER
Note that XFD directives are case-insensitive and that hyphens and underscores are considered equivalent. Thus, for example,
$XFD VAR_LENGTH $XFD VAR-LENGTH $xfd var_length $xfd var-length
are all recognized as equivalent by the Database Connectors™ family of products.
Two or more XFD directives that pertain to the same line of COBOL code may be combined on one comment line. The XFD directives should be separated by a space or a comma. For example, to specify both USE GROUP and NUMERIC at the same time, you would add this line:
$XFD USE GROUP, NUMERIC
The following section provides a brief description of each of the XFD directives, listed in alphabetical order. For detailed descriptions of the XFD directives, follow their links.
The Database Connectors interfaces support the following XFD directives. For complete definitions of these directives, look in the Reference > XFD Directives section of the Database Connectors documentation.
| XFD Directive | Brief Description |
|---|---|
| ALPHA | Allows you to treat a data item as alphanumeric text in the database, when it is declared as numeric in the COBOL program |
| BINARY | Specifies that the data in the field could be alphanumeric data of any classification |
| COBOL-TRIGGER | Tells Database Connectors that a COBOL trigger is to be executed |
| COMMENT | Allows you to include comments in an XFD file |
| CREATEXFD | Generates the XFDs required by Database Connectors |
| DATE | Stores a field in the database as a date |
| FILE | Supplies a starting name from which the XFD file name is formed |
| NAME | Assigns a database field name to the field defined on the next line |
| NUMERIC | Allows you to treat a data item as an unsigned integer when it is declared as alphanumeric |
| SECONDARY_TABLE | Indicates that the next data item may be placed into a subordinate table |
| USE GROUP | Allows you to enter a group item into the database as a single field |
| VAR_LENGTH | Requests that the data item that immediately follows the XFD directive be assigned a type that implies variable length |
| WHEN | Lets you include multiple record definitions or REDEFINES in a database table |
| XSL | Allows you to include a stylesheet reference in the XML header |
Copyright © 2009 Micro Focus (IP) Ltd. All rights reserved.