VAR_LENGTH XFD directive

By default, the Compiler generates fixed-length fields in the XFD. The VAR_LENGTH XFD directive requests that the data item that immediately follows the XFD directive be assigned a type that implies variable length, if possible. This can save considerable space in your database.

The VAR_LENGTH XFD directive cannot be used in combination with the BINARY XFD directive.

The precise variable type that is assigned to the data item depends on which RDBMS is in use. Possible variable types that might be assigned are VARCHAR and VARBINARY.

Syntax

$XFD VAR_LENGTH

Example

For example, the XFD directive in the following code indicates that the employee-name field should be entered into a DB2 database as a VARCHAR data item.

 $XFD  VAR_LENGTH
      03  employee-notes      pic x(300).