MainframeMaster

COBOL Tutorial

COBOL LINE Clause - Quick Reference

Progress0 of 0 lessons

Overview

The LINE clause is a positioning clause used in COBOL screen handling to specify the vertical position (row number) where text or input fields should appear on the terminal screen. It is commonly used with DISPLAY and ACCEPT statements to control cursor positioning.

Purpose and Usage

  • Vertical positioning - Controls which row (line) text appears on
  • Screen layout control - Enables precise placement of screen elements
  • User interface design - Creates organized, readable screen layouts
  • Cursor management - Positions cursor for input and output operations
  • Menu and form design - Essential for creating structured user interfaces

Terminal Screen Coordinates

┌─────────────────────────────────────────────────────────────────────────────┐
│ Line 1 │ │
│ Line 2 │ │
│ Line 3 │ │
│ Line 4 │ │
│ Line 5 │ │
│ ... │ │
│ Line 23 │ │
│ Line 24 │ │
└─────────┴─────────────────────────────────────────────────────────────────┘
Column: 1 10 20 30 40 50 60 70 80

Standard terminal screens typically have 24 or 25 lines, with LINE 1 at the top and LINE 24/25 at the bottom.

Syntax

The LINE clause follows a specific syntax pattern and can be used in various contexts within COBOL screen handling statements.

Basic Syntax

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
* Basic LINE clause syntax AT LINE line-number * Examples AT LINE 5 AT LINE 10 AT LINE 24 * With COLUMN clause for complete positioning AT LINE line-number AT COLUMN column-number * Examples of complete positioning AT LINE 5 AT COLUMN 10 AT LINE 10 AT COLUMN 20 AT LINE 1 AT COLUMN 1

The AT keyword is required, and line-number must be a positive integer.

Valid Line Number Ranges

Terminal TypeLine RangeCommon Usage
Standard Terminal1 to 24Most common terminal type
Extended Terminal1 to 25Some modern terminals
Large Terminal1 to 43High-resolution terminals
PC Terminal1 to 50PC-based terminal emulators

Using Variables and Expressions

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
* Using variables with LINE clause AT LINE CURRENT-LINE AT COLUMN 10 * Using arithmetic expressions AT LINE (LINE-NUMBER + 2) AT COLUMN 10 AT LINE (START-LINE + OFFSET) AT COLUMN 15 * Using data names AT LINE MENU-LINE AT COLUMN 20 AT LINE HEADER-LINE AT COLUMN 1 * Examples with working storage WORKING-STORAGE SECTION. 01 CURRENT-LINE PIC 9(2) VALUE 5. 01 MENU-LINE PIC 9(2) VALUE 8. 01 HEADER-LINE PIC 9(2) VALUE 1. 01 LINE-OFFSET PIC 9(2) VALUE 2. PROCEDURE DIVISION. DISPLAY "Header" AT LINE HEADER-LINE AT COLUMN 1 DISPLAY "Menu" AT LINE MENU-LINE AT COLUMN 10 DISPLAY "Content" AT LINE (CURRENT-LINE + LINE-OFFSET) AT COLUMN 5

Variables and expressions provide dynamic positioning capabilities.

Usage in DISPLAY Statements

The LINE clause is commonly used in DISPLAY statements to control where output text appears on the screen.

Basic DISPLAY with LINE

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
* Simple DISPLAY with LINE positioning DISPLAY "Hello World" AT LINE 5 AT COLUMN 10 * Multiple positioned displays DISPLAY "Title" AT LINE 1 AT COLUMN 20 DISPLAY "Subtitle" AT LINE 2 AT COLUMN 20 DISPLAY "Content" AT LINE 5 AT COLUMN 10 * Display with attributes DISPLAY "Important Message" AT LINE 10 AT COLUMN 5 WITH HIGHLIGHT DISPLAY "Error" AT LINE 15 AT COLUMN 5 WITH REVERSE-VIDEO * Display variables at specific positions DISPLAY "Customer ID: " AT LINE 8 AT COLUMN 10 DISPLAY CUSTOMER-ID AT LINE 8 AT COLUMN 25

LINE positioning ensures consistent screen layouts and professional appearance.

Creating Menu Layouts

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
* Menu layout using LINE positioning DISPLAY "CUSTOMER MANAGEMENT SYSTEM" AT LINE 1 AT COLUMN 15 WITH HIGHLIGHT DISPLAY "================================================" AT LINE 2 AT COLUMN 1 DISPLAY "MAIN MENU" AT LINE 4 AT COLUMN 20 DISPLAY "---------" AT LINE 5 AT COLUMN 20 DISPLAY "1. Add Customer" AT LINE 7 AT COLUMN 20 DISPLAY "2. View Customer" AT LINE 8 AT COLUMN 20 DISPLAY "3. Update Customer" AT LINE 9 AT COLUMN 20 DISPLAY "4. Delete Customer" AT LINE 10 AT COLUMN 20 DISPLAY "5. Exit" AT LINE 11 AT COLUMN 20 DISPLAY "Enter your choice: " AT LINE 13 AT COLUMN 20 DISPLAY "================================================" AT LINE 15 AT COLUMN 1 * Status message area DISPLAY "Status: " AT LINE 20 AT COLUMN 10 DISPLAY STATUS-MESSAGE AT LINE 20 AT COLUMN 20

Structured layouts improve user experience and readability.

Screen Clearing and Positioning

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
* Clear screen and position at top DISPLAY SPACES AT LINE 1 AT COLUMN 1 * Clear specific areas DISPLAY SPACES AT LINE 10 AT COLUMN 1 DISPLAY SPACES AT LINE 11 AT COLUMN 1 DISPLAY SPACES AT LINE 12 AT COLUMN 1 * Position cursor after clearing DISPLAY "New content" AT LINE 5 AT COLUMN 10 * Clear status area DISPLAY SPACES AT LINE 20 AT COLUMN 1 DISPLAY "New status message" AT LINE 20 AT COLUMN 10 * Clear entire screen (alternative method) DISPLAY SPACES AT LINE 1 AT COLUMN 1 ERASE

Screen clearing ensures clean displays and prevents overlapping text.

Usage in ACCEPT Statements

The LINE clause is also used in ACCEPT statements to position input fields on the screen for user data entry.

Basic ACCEPT with LINE

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
* Simple ACCEPT with LINE positioning ACCEPT USER-NAME AT LINE 5 AT COLUMN 20 * ACCEPT with prompt and positioning ACCEPT CUSTOMER-ID AT LINE 8 AT COLUMN 25 PROMPT "Customer ID: " * Multiple positioned accepts ACCEPT CUSTOMER-ID AT LINE 8 AT COLUMN 25 PROMPT "Customer ID: " ACCEPT CUSTOMER-NAME AT LINE 9 AT COLUMN 25 PROMPT "Customer Name: " ACCEPT CUSTOMER-ADDRESS AT LINE 10 AT COLUMN 25 PROMPT "Address: " * ACCEPT with attributes ACCEPT PASSWORD AT LINE 12 AT COLUMN 25 PROMPT "Password: " WITH SECURE

LINE positioning in ACCEPT creates organized input forms.

Form Layout with ACCEPT

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
* Complete form layout DISPLAY "CUSTOMER ENTRY FORM" AT LINE 1 AT COLUMN 15 WITH HIGHLIGHT DISPLAY "================================================" AT LINE 2 AT COLUMN 1 * Form fields with positioning ACCEPT CUSTOMER-ID AT LINE 5 AT COLUMN 25 PROMPT "Customer ID: " REQUIRED AUTO-SKIP ACCEPT CUSTOMER-NAME AT LINE 6 AT COLUMN 25 PROMPT "Customer Name: " REQUIRED AUTO-SKIP ACCEPT CUSTOMER-ADDRESS AT LINE 7 AT COLUMN 25 PROMPT "Address: " AUTO-SKIP ACCEPT CUSTOMER-PHONE AT LINE 8 AT COLUMN 25 PROMPT "Phone: " AUTO-SKIP * Instructions at bottom DISPLAY "Press ENTER to save, ESC to cancel" AT LINE 12 AT COLUMN 10 DISPLAY "================================================" AT LINE 14 AT COLUMN 1

Well-structured forms improve data entry efficiency and reduce errors.

Dynamic Positioning with Variables

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
WORKING-STORAGE SECTION. 01 CURRENT-LINE PIC 9(2) VALUE 5. 01 FIELD-OFFSET PIC 9(2) VALUE 2. PROCEDURE DIVISION. * Position first field ACCEPT CUSTOMER-ID AT LINE CURRENT-LINE AT COLUMN 25 PROMPT "Customer ID: " * Position subsequent fields dynamically ADD FIELD-OFFSET TO CURRENT-LINE ACCEPT CUSTOMER-NAME AT LINE CURRENT-LINE AT COLUMN 25 PROMPT "Customer Name: " ADD FIELD-OFFSET TO CURRENT-LINE ACCEPT CUSTOMER-ADDRESS AT LINE CURRENT-LINE AT COLUMN 25 PROMPT "Address: " ADD FIELD-OFFSET TO CURRENT-LINE ACCEPT CUSTOMER-PHONE AT LINE CURRENT-LINE AT COLUMN 25 PROMPT "Phone: "

Dynamic positioning allows flexible form layouts and easy maintenance.

Usage in SCREEN SECTION

The LINE clause is extensively used in the SCREEN SECTION to define the layout and positioning of screen elements in formatted screens.

SCREEN SECTION with LINE

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
DATA DIVISION. SCREEN SECTION. 01 CUSTOMER-SCREEN. 05 LINE 1 COLUMN 1 VALUE "================================================". 05 LINE 2 COLUMN 15 VALUE "CUSTOMER MANAGEMENT SYSTEM" HIGHLIGHT. 05 LINE 3 COLUMN 1 VALUE "================================================". 05 LINE 5 COLUMN 10 VALUE "Customer ID: ". 05 LINE 5 COLUMN 25 PIC X(10) TO CUSTOMER-ID REQUIRED AUTO-SKIP. 05 LINE 6 COLUMN 10 VALUE "Customer Name: ". 05 LINE 6 COLUMN 25 PIC X(30) TO CUSTOMER-NAME REQUIRED AUTO-SKIP. 05 LINE 7 COLUMN 10 VALUE "Address: ". 05 LINE 7 COLUMN 25 PIC X(40) TO CUSTOMER-ADDRESS AUTO-SKIP. 05 LINE 8 COLUMN 10 VALUE "Phone: ". 05 LINE 8 COLUMN 25 PIC X(15) TO CUSTOMER-PHONE AUTO-SKIP. 05 LINE 10 COLUMN 10 VALUE "Status: ". 05 LINE 10 COLUMN 20 PIC X(40) FROM STATUS-MESSAGE. 05 LINE 12 COLUMN 10 VALUE "Press ENTER to save, ESC to cancel". 05 LINE 14 COLUMN 1 VALUE "================================================".

SCREEN SECTION provides structured screen layouts with precise positioning.

Menu Screen Definition

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
01 MENU-SCREEN. 05 LINE 1 COLUMN 1 VALUE "================================================". 05 LINE 2 COLUMN 15 VALUE "MAIN MENU" HIGHLIGHT. 05 LINE 3 COLUMN 1 VALUE "================================================". 05 LINE 5 COLUMN 20 VALUE "1. Add Customer". 05 LINE 6 COLUMN 20 VALUE "2. View Customer". 05 LINE 7 COLUMN 20 VALUE "3. Update Customer". 05 LINE 8 COLUMN 20 VALUE "4. Delete Customer". 05 LINE 9 COLUMN 20 VALUE "5. Search Customer". 05 LINE 10 COLUMN 20 VALUE "6. Exit". 05 LINE 12 COLUMN 20 VALUE "Enter your choice: ". 05 LINE 12 COLUMN 40 PIC 9 TO MENU-CHOICE REQUIRED AUTO-SKIP. 05 LINE 14 COLUMN 20 VALUE "----------------------------------------". 05 LINE 16 COLUMN 20 VALUE "F1=Help ESC=Exit". 05 LINE 18 COLUMN 1 VALUE "================================================".

Menu screens provide clear navigation with consistent positioning.

Using Variables in SCREEN SECTION

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
WORKING-STORAGE SECTION. 01 HEADER-LINE PIC 9(2) VALUE 1. 01 MENU-START-LINE PIC 9(2) VALUE 5. 01 STATUS-LINE PIC 9(2) VALUE 20. SCREEN SECTION. 01 DYNAMIC-SCREEN. 05 LINE HEADER-LINE COLUMN 1 VALUE "================================================". 05 LINE HEADER-LINE COLUMN 15 VALUE "DYNAMIC SCREEN" HIGHLIGHT. 05 LINE (HEADER-LINE + 1) COLUMN 1 VALUE "================================================". 05 LINE MENU-START-LINE COLUMN 20 VALUE "Menu Option 1". 05 LINE (MENU-START-LINE + 1) COLUMN 20 VALUE "Menu Option 2". 05 LINE (MENU-START-LINE + 2) COLUMN 20 VALUE "Menu Option 3". 05 LINE STATUS-LINE COLUMN 10 VALUE "Status: ". 05 LINE STATUS-LINE COLUMN 20 PIC X(40) FROM STATUS-MESSAGE.

Variables in SCREEN SECTION enable flexible, maintainable screen layouts.

Practical Examples

These practical examples demonstrate common usage patterns and techniques for the LINE clause in real-world COBOL applications.

Complete Customer Entry Program

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
IDENTIFICATION DIVISION. PROGRAM-ID. CUSTOMER-ENTRY. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 CUSTOMER-ID PIC X(10). 01 CUSTOMER-NAME PIC X(30). 01 CUSTOMER-ADDRESS PIC X(40). 01 CUSTOMER-PHONE PIC X(15). 01 STATUS-MESSAGE PIC X(40). 01 EXIT-FLAG PIC X VALUE "N". 88 EXIT-PROGRAM VALUE "Y". SCREEN SECTION. 01 CUSTOMER-ENTRY-SCREEN. 05 LINE 1 COLUMN 1 VALUE "================================================". 05 LINE 2 COLUMN 15 VALUE "CUSTOMER ENTRY FORM" HIGHLIGHT. 05 LINE 3 COLUMN 1 VALUE "================================================". 05 LINE 5 COLUMN 10 VALUE "Customer ID: ". 05 LINE 5 COLUMN 25 PIC X(10) TO CUSTOMER-ID REQUIRED AUTO-SKIP. 05 LINE 6 COLUMN 10 VALUE "Customer Name: ". 05 LINE 6 COLUMN 25 PIC X(30) TO CUSTOMER-NAME REQUIRED AUTO-SKIP. 05 LINE 7 COLUMN 10 VALUE "Address: ". 05 LINE 7 COLUMN 25 PIC X(40) TO CUSTOMER-ADDRESS AUTO-SKIP. 05 LINE 8 COLUMN 10 VALUE "Phone: ". 05 LINE 8 COLUMN 25 PIC X(15) TO CUSTOMER-PHONE AUTO-SKIP. 05 LINE 10 COLUMN 10 VALUE "Status: ". 05 LINE 10 COLUMN 20 PIC X(40) FROM STATUS-MESSAGE. 05 LINE 12 COLUMN 10 VALUE "Press ENTER to save, ESC to exit". 05 LINE 14 COLUMN 1 VALUE "================================================". PROCEDURE DIVISION. MAIN-PROCESS. PERFORM UNTIL EXIT-PROGRAM PERFORM DISPLAY-CUSTOMER-FORM PERFORM PROCESS-CUSTOMER-DATA END-PERFORM STOP RUN. DISPLAY-CUSTOMER-FORM. MOVE SPACES TO CUSTOMER-ID MOVE SPACES TO CUSTOMER-NAME MOVE SPACES TO CUSTOMER-ADDRESS MOVE SPACES TO CUSTOMER-PHONE MOVE SPACES TO STATUS-MESSAGE ACCEPT OMITTED FROM CUSTOMER-ENTRY-SCREEN. PROCESS-CUSTOMER-DATA. IF CUSTOMER-ID NOT = SPACES AND CUSTOMER-NAME NOT = SPACES PERFORM SAVE-CUSTOMER MOVE "Customer saved successfully" TO STATUS-MESSAGE DISPLAY STATUS-MESSAGE AT LINE 10 AT COLUMN 20 ELSE MOVE "Customer ID and Name are required" TO STATUS-MESSAGE DISPLAY STATUS-MESSAGE AT LINE 10 AT COLUMN 20 END-IF. SAVE-CUSTOMER. * Here you would add code to save to file or database DISPLAY "Saving customer data..." AT LINE 15 AT COLUMN 10.

This complete program demonstrates LINE clause usage in a practical application.

Multi-Screen Navigation

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
WORKING-STORAGE SECTION. 01 MENU-CHOICE PIC 9. 01 CURRENT-SCREEN PIC 9 VALUE 1. SCREEN SECTION. 01 MAIN-MENU-SCREEN. 05 LINE 1 COLUMN 1 VALUE "================================================". 05 LINE 2 COLUMN 15 VALUE "MAIN MENU" HIGHLIGHT. 05 LINE 3 COLUMN 1 VALUE "================================================". 05 LINE 5 COLUMN 20 VALUE "1. Customer Entry". 05 LINE 6 COLUMN 20 VALUE "2. Customer Search". 05 LINE 7 COLUMN 20 VALUE "3. Reports". 05 LINE 8 COLUMN 20 VALUE "4. Exit". 05 LINE 10 COLUMN 20 VALUE "Enter your choice: ". 05 LINE 10 COLUMN 40 PIC 9 TO MENU-CHOICE REQUIRED AUTO-SKIP. 01 SEARCH-SCREEN. 05 LINE 1 COLUMN 1 VALUE "================================================". 05 LINE 2 COLUMN 15 VALUE "CUSTOMER SEARCH" HIGHLIGHT. 05 LINE 3 COLUMN 1 VALUE "================================================". 05 LINE 5 COLUMN 10 VALUE "Search by ID: ". 05 LINE 5 COLUMN 25 PIC X(10) TO SEARCH-ID REQUIRED AUTO-SKIP. 05 LINE 7 COLUMN 10 VALUE "Search by Name: ". 05 LINE 7 COLUMN 25 PIC X(30) TO SEARCH-NAME AUTO-SKIP. 05 LINE 9 COLUMN 10 VALUE "Press ENTER to search, ESC to return". PROCEDURE DIVISION. MAIN-PROCESS. PERFORM UNTIL EXIT-PROGRAM EVALUATE CURRENT-SCREEN WHEN 1 PERFORM DISPLAY-MAIN-MENU WHEN 2 PERFORM DISPLAY-SEARCH-SCREEN WHEN OTHER MOVE 1 TO CURRENT-SCREEN END-EVALUATE END-PERFORM STOP RUN. DISPLAY-MAIN-MENU. ACCEPT OMITTED FROM MAIN-MENU-SCREEN EVALUATE MENU-CHOICE WHEN 1 MOVE 2 TO CURRENT-SCREEN WHEN 2 MOVE 3 TO CURRENT-SCREEN WHEN 4 MOVE "Y" TO EXIT-FLAG END-EVALUATE. DISPLAY-SEARCH-SCREEN. ACCEPT OMITTED FROM SEARCH-SCREEN IF SEARCH-ID NOT = SPACES PERFORM SEARCH-CUSTOMER END-IF MOVE 1 TO CURRENT-SCREEN.

Multi-screen applications use LINE positioning for consistent navigation.

Error Handling with LINE

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
PROCEDURE DIVISION. VALIDATE-CUSTOMER-DATA. MOVE "Y" TO VALID-FLAG * Validate Customer ID IF CUSTOMER-ID = SPACES OR CUSTOMER-ID = ZEROS MOVE "N" TO VALID-FLAG DISPLAY "Error: Customer ID is required" AT LINE 15 AT COLUMN 10 WITH HIGHLIGHT END-IF * Validate Customer Name IF CUSTOMER-NAME = SPACES MOVE "N" TO VALID-FLAG DISPLAY "Error: Customer Name is required" AT LINE 16 AT COLUMN 10 WITH HIGHLIGHT END-IF * Validate Phone Number IF CUSTOMER-PHONE NOT = SPACES IF CUSTOMER-PHONE NOT NUMERIC MOVE "N" TO VALID-FLAG DISPLAY "Error: Phone number must be numeric" AT LINE 17 AT COLUMN 10 WITH HIGHLIGHT END-IF END-IF * Clear error messages if valid IF VALID-FLAG = "Y" DISPLAY SPACES AT LINE 15 AT COLUMN 10 DISPLAY SPACES AT LINE 16 AT COLUMN 10 DISPLAY SPACES AT LINE 17 AT COLUMN 10 DISPLAY "Data validation successful" AT LINE 15 AT COLUMN 10 WITH LOWLIGHT END-IF.

LINE positioning is essential for organized error message display.

Best Practices and Tips

Following these best practices ensures effective and maintainable use of the LINE clause in COBOL screen handling applications.

Line Positioning Best Practices

  • Use consistent spacing - Maintain 1-2 lines between screen elements
  • Reserve header lines - Use lines 1-3 for titles and headers
  • Use bottom lines for status - Reserve lines 20-24 for messages and navigation
  • Avoid overlapping - Ensure sufficient spacing between elements
  • Use variables for flexibility - Define line positions as variables for easy maintenance
  • Test on target terminal - Verify positioning works on actual hardware
  • Document layouts - Keep screen layout documentation for maintenance
  • Validate line numbers - Ensure line numbers are within terminal limits

Common Pitfalls to Avoid

PitfallProblemSolution
Hard-coded line numbersDifficult to maintain and modifyUse variables for line positions
Overlapping textUnreadable screen outputPlan spacing and clear areas
Invalid line numbersRuntime errors or unexpected behaviorValidate against terminal limits
Inconsistent positioningPoor user experienceUse standard layout templates
No error handlingPoor user feedbackImplement proper error positioning

Performance Considerations

  • Minimize screen updates - Only update necessary lines
  • Use efficient positioning - Plan layouts to minimize cursor movement
  • Batch screen operations - Group related displays together
  • Avoid excessive clearing - Clear only specific areas when needed
  • Use appropriate line ranges - Stay within terminal capabilities
  • Optimize for target hardware - Consider terminal performance limitations

Maintenance Guidelines

  • Use meaningful variable names - Choose descriptive names for line positions
  • Centralize line definitions - Define all line positions in one place
  • Document screen layouts - Maintain visual documentation of screen designs
  • Use constants for magic numbers - Define line numbers as named constants
  • Test across terminals - Verify layouts work on different terminal types
  • Plan for changes - Design layouts to accommodate future modifications

LINE Clause Quick Reference

UsageSyntaxExample
DISPLAY positioningAT LINE line-numberAT LINE 5 AT COLUMN 10
ACCEPT positioningAT LINE line-numberAT LINE 8 AT COLUMN 25
SCREEN SECTIONLINE line-numberLINE 5 COLUMN 10
With variablesAT LINE variable-nameAT LINE CURRENT-LINE
With expressionsAT LINE (expression)AT LINE (LINE-NUM + 2)

Test Your Knowledge

1. What is the primary purpose of the LINE clause in COBOL?

  • To define data types
  • To specify the vertical position on the screen
  • To control file operations
  • To perform calculations

2. In which statements can the LINE clause be used?

  • Only in DISPLAY statements
  • Only in ACCEPT statements
  • In both DISPLAY and ACCEPT statements
  • Only in SCREEN SECTION definitions

3. What is the typical range for LINE values in most COBOL implementations?

  • 0 to 99
  • 1 to 24 or 1 to 25
  • 1 to 100
  • 0 to 23

4. How do you combine LINE and COLUMN clauses for precise positioning?

  • LINE line-number COLUMN column-number
  • AT LINE line-number AT COLUMN column-number
  • POSITION line-number, column-number
  • LOCATE line-number, column-number

5. What happens if you omit the LINE clause in a DISPLAY statement?

  • The program will terminate with an error
  • The text will appear at the current cursor position
  • The text will appear at line 1
  • The text will not be displayed

Frequently Asked Questions