Host variable names in COBOL

The SQL precompiler identifies host variables by their declared name.
You must comply with the following rules when declaring host variable names:
  • Specify variable names up to 255 characters in length.
  • Begin host variable names with prefixes other than SQL, sql, DB2, or db2, which are reserved for system use.
  • FILLER items using the declaration syntaxes are permitted in group host variable declarations, and will be ignored by the precompiler. However, if you use FILLER more than once within an SQL DECLARE section, the precompiler fails. You can not include FILLER items in VARCHAR, LONG VARCHAR, VARGRAPHIC or LONG VARGRAPHIC declarations.
  • You can use hyphens in host variable names.

    SQL interprets a hyphen enclosed by spaces as a subtraction operator. Use hyphens without spaces in host variable names.

  • The REDEFINES clause is permitted in host variable declarations.
  • Level-88 declarations are permitted in the host variable declare section, but are ignored.