AS400上编写COBOL的SCREEN SECTION报错LNC1030求助
Hey there! Let’s break down why you’re hitting that LNC1030 error with your SCREEN SECTION in COBOL on the AS400. The problem isn’t your spelling of SCREEN SECTION—it’s what comes after that line that’s tripping up the compiler.
Why the Error Occurs
IBM i’s ILE COBOL compiler enforces a strict rule: if you declare a SCREEN SECTION., it can’t be empty or only contain comments. This section is meant to define layouts for interactive screen programs, so the compiler expects at least one valid screen description entry. Since your code declares the section but provides no actual screen definitions, it throws the "SCREEN INCORRECT" error.
Solution 1: Remove the SCREEN SECTION (if you don’t need it)
Looking at your code, you’re just running a simple DISPLAY statement—no interactive screen logic is involved. The quickest fix is to delete the entire SCREEN SECTION. line and the comment below it. Your program will work perfectly without it:
PROCEDURE DIVISION. **======================================================== DISPLAY "Bonjour tout le monde" "Hello World". exit program.
Solution 2: Add a Minimal Screen Definition (if you need the section)
If you plan to add interactive screen functionality later, you need to include at least a basic screen entry to satisfy the compiler. For example, you can define a blank screen placeholder:
SCREEN SECTION. 01 BASIC-SCREEN. BLANK SCREEN. **==================================================== PROCEDURE DIVISION. **======================================================== DISPLAY "Bonjour tout le monde" "Hello World". exit program.
This meets the compiler’s requirement for a valid screen definition while keeping your existing DISPLAY code functional.
内容的提问来源于stack exchange,提问作者Fazah

