Host variables are data items defined within a COBOL program. They are used to pass values to and receive values from a database.
Host variables can be defined in the File Section, Working-Storage Section, Local-Storage Section or Linkage Section of your
COBOL program and can be coded using any level number between 1 and 48.
A host variable can be input or output:
- Input host variables - to specify data to be transferred from the COBOL program to the database
- Output host variables - to hold data to be returned to the COBOL program from the database
To use host variables, you must declare them in your program and then reference them in your SQL statements.
A host variable can be defined as any of the following types:
- Simple Host Variable - to store and retrieve a single string of data
- Host Array - to store and retrieve multiple rows of data
- Indicator Variable - a companion variable that store null value and data truncation information
- Indicator Array - a companion array used to store null value and data truncation information for multiple rows
See the topics listed under
Related concepts below for more information on features related to host variables.