CHAR(length)

The CHAR keyword is used in a free-form definition to indicate that the item is fixed-length character.

It must be the first keyword.

The parameter specifies the length in bytes. It can be between 1 and 16,773,104

The parameter can be a literal or a named constant. If it is a named constant, the constant must be defined prior to the definition statement.

In the following example
  • field cust_name is defined as a fixed-length character field with 100 characters.
  • field message is defined as a fixed-length character field with 5000 characters. The length is defined using named constant MSG_LEN.

  DCL-S cust_name CHAR(100);
  DCL-C MSG_LEN 5000;
  DCL-S message CHAR(MSG_LEN);

For information on defining a variable-length character item, see VARCHAR(length {:2 | 4}).