COBOL Online Compiler and Runner
COBOL Online Compiler and Runner
Teaching interpreter: this page runs a beginner subset of COBOL
entirely in your browser — it is not a full COBOL compiler and does not connect to a
mainframe. Type a program on the left, press Run, and see the output on the right.
COBOL source
Console output
Most Common COBOL Programs
Click Load & Run on any card to load the program into the editor above and run it instantly.
Supported statements (beginner subset)
WORKING-STORAGE:01/77levels withPIC X(n),PIC 9(n),PIC 9(n)V9(m)DISPLAY 'text' var1 var2— string literals in quotes plus variablesMOVE a TO b— literal or variable to variableCOMPUTE x = expression— with+ - * /and parenthesesADD a TO b—SUBTRACT a FROM b—MULTIPLY a BY b—DIVIDE a INTO bIF condition ... ELSE ... END-IF— conditions:= <> > < >= <=,AND/ORPERFORM n TIMES ... END-PERFORM—PERFORM UNTIL condition ... END-PERFORM- Paragraphs (
PARA-NAME.) called withPERFORM PARA-NAME ACCEPT var(uses a browser prompt) —STOP RUN
Errors are reported with line numbers, e.g. Line 7: unknown variable WS-FOO.
Not supported: files (FD/SELECT), CALL, COPY,
OCCURS tables, EVALUATE — the interpreter will tell you when it meets something it cannot run.
