Skip to content

Instantly share code, notes, and snippets.

@juliarose
Created April 20, 2024 00:39
Show Gist options
  • Save juliarose/7a28f89871991fdf98cf8f1633be435f to your computer and use it in GitHub Desktop.
Save juliarose/7a28f89871991fdf98cf8f1633be435f to your computer and use it in GitHub Desktop.
A simple COBOL template without line numbers.
*Format lines:
* awk -i inplace '{printf("%04d00%s\n", NR, substr($0,7,120)) }' main.cbl
*Compile and run:
* cobc -x main.cbl && ./main
IDENTIFICATION DIVISION.
PROGRAM-ID. hello.
AUTHOR. Julia.
DATE-WRITTEN. 2024-04-19.
DATE-COMPILED. 2024-04-19.
REMARKS. This is a pretty good COBOL program.
*
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. Ubuntu_Linux_x64_20_04_6_LTS.
OBJECT-COMPUTER. Ubuntu_Linux_x64_20_04_6_LTS.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
I-O-CONTROL.
*
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
*Local storage is re-allocated each time a program is called.
LOCAL-STORAGE SECTION.
LINKAGE SECTION.
*Report and screen section not available with IBM Cobol x86
*Commented to avoid compilation warning
* REPORT SECTION.
SCREEN SECTION.
*
PROCEDURE DIVISION.
DISPLAY "Hello, world!".
STOP RUN.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment