COBOL Tutorial

Progress0 of 0 lessons

COBOL COLUMN

COLUMN is a clause that sets the horizontal position (column number) where a screen or report field appears. Use it in the SCREEN SECTION with LINE (e.g. LINE 5 COLUMN 20) or in report group descriptions. Column 1 is the leftmost position. For COL and COLUMNS see COLUMN-AND-COLUMNS.

Where it is used

COLUMN appears in data description entries in the DATA DIVISION: in SCREEN SECTION for screen layout (each elementary item typically has LINE and/or COLUMN, or VALUE, PIC, etc.) and in report writer or report line definitions to position output fields.

cobol
1
2
3
4
5
6
7
8
9
10
SCREEN SECTION. 01 CUSTOMER-SCREEN. 05 LINE 5 COLUMN 20 VALUE "Customer ID:". 05 CUST-ID-FIELD LINE 5 COLUMN 35 PIC X(8). *> Report-style: column positions for output 01 REPORT-LINE. 05 CUST-ID-OUT PIC X(8) COLUMN 10. 05 NAME-OUT PIC X(30) COLUMN 20. 05 AMT-OUT PIC Z,ZZ9.99 COLUMN 55.

Common forms

COLUMN examples
ExampleMeaning
COLUMN 1Field starts at the leftmost column
LINE 5 COLUMN 20Screen item at row 5, column 20
COLUMN 55Report or screen field starts at column 55

LINE and COLUMN together

In screen layouts, LINE is the row (vertical position) and COLUMN is the column (horizontal position). Together they fix where the field appears. For example LINE 8 COLUMN 25 means row 8, column 25. Omitted LINE or COLUMN may default to the current line or column depending on the implementation.

Explain like I'm five

COLUMN is the “which box across” on the screen or report. LINE is “which row down.” COLUMN 1 is the first box from the left; COLUMN 40 is the 40th box from the left.

Test Your Knowledge

1. What does COLUMN specify?

  • Record length
  • Horizontal position of a field
  • Line number
  • File name

2. In SCREEN SECTION, COLUMN is often used with which other clause?

  • PICTURE
  • LINE
  • VALUE
  • SIZE

Related Concepts

Related Pages