VAR_LENGTH directive

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

The VAR_LENGTH directive cannot be used in combination with the BINARY 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 directive in the following code indicates that the employee-name field should be entered into the database as a VARCHAR data item.

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