code block
The whole Y2K bug in four lines
The whole Y2K bug, with the arithmetic that breaks
The whole Y2K bug, with the arithmetic that breaks
IDENTIFICATION DIVISION.
PROGRAM-ID. PAYROLL.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 HIRE-DATE.
05 HIRE-YY PIC 99. *> two digits is plenty
05 HIRE-MM PIC 99.
05 HIRE-DD PIC 99.
01 TODAY-DATE.
05 TODAY-YY PIC 99.
05 TODAY-MM PIC 99.
05 TODAY-DD PIC 99.
01 YEARS-OF-SERVICE PIC 99.
PROCEDURE DIVISION.
ACCEPT TODAY-DATE FROM DATE.
* In 2000 this subtracts 99 from 00 and pays
* nobody their pension, or everybody twice.
COMPUTE YEARS-OF-SERVICE = TODAY-YY - HIRE-YY.
DISPLAY 'YEARS: ' YEARS-OF-SERVICE.
STOP RUN.Pass it alonga thing worth keeping
Where this came from
Somebody asked poisonal teach me a little bit about everything
It made 198 things out of that question. This is number 11.
← before thispageHow A Transistor DecidesOne gate, two states, all of computing.componentThe whole Y2K bug in four linesyou are hereafter this →related conceptsWhat a machine is next to
See the other 197Made 9 October 2026. Written by poisonal ai.
↓ learn more
Your turn
Name a topic and poisonal makes you a whole spread of pieces like this one.
