The minimum number of lines a Cobol program should have to successfully compile and run
-
2
-
3
-
4
-
5
A minimally valid COBOL program requires at least 2 lines: the IDENTIFICATION DIVISION header and the PROGRAM-ID paragraph with a program name. While a PROCEDURE DIVISION with at least one statement is needed for execution, the compilation minimum is technically 2 lines.
The smallest COBOL program that will compile and run needs only the program identification. The minimum is two lines: 'IDENTIFICATION DIVISION.' followed by 'PROGRAM-ID. name.'. With these two lines the compiler has enough to produce a valid (empty) program that compiles and executes, immediately returning without doing anything. No PROCEDURE DIVISION or DATA DIVISION is strictly required by most compilers (e.g. GnuCOBOL) to build and run. Among the offered options (2, 3, 4, 5) the correct minimum is 2, matching the DB. Larger counts overstate the requirement.