• Home
    Creating a ‘hello world’ program with punch cards

    Needed Equipment, Software, and Other Preparations:

    • IBM029 Keypunch machine or similar: This is the machine you’ll use to punch the holes in the punch cards. They may be hard to come by, as they are relics of an older computing era.
    • Punch cards: This is the medium onto which you’ll be employing the machine to encode your program. They’re sometimes also known as IBM Cards or Hollerith cards.
    • IBM System/360 or similar: You’re going to need a compatible mainframe system to run your punched-card program on.
    • JCL (Job Control Language): This is the scripting language used in mainframe systems to control the execution of programs.
    • COBOL or FORTRAN or a similar programming language: ‘Hello, World!’ programs were typically written in these high-level languages during the punch card era. You should understand the basics of either language.

    Foundational Concepts:

    • Punched card programming: Cards are punched with a specific pattern to denote alphanumeric characters. These patterns – if read and decoded properly by a computer – will execute as a valid program.
    • Keypunch operation: Each card has 80 columns, each column being capable of having different combinations of hole punches. These combinations essentially represent characters, like a coded language.
    • Mainframe systems: Hefty computing systems popular before the rise of personal computers. They receive input, execute programs, and produce output, albeit in a very different manner to modern computers.

    Let’s now move onto the step-by-step guide.

    Step 1: Working on the Logic of ‘Hello, World!’ program

    Before coding, determine your problem-solving approach. With a ‘Hello, World!’ program, it’s straightforward: you need to instruct the computer to print this phrase.

    Step 2: Writing the Program in COBOL

    Here’s a simple ‘Hello, World!’ program in COBOL:

        DISPLAY 'Hello, World!'.
        STOP RUN.

    Decipher each line:

    • IDENTIFICATION DIVISION is where the program gets its name.
    • PROGRAM-ID. HELLOWORLD is specifying the name of the program.
    • PROCEDURE DIVISION includes the code that will run when the program is executed.
    • DISPLAY ‘Hello, World!’ tells the computer to print ‘Hello, World!’.
    • STOP RUN ends the program.

    Step 3: Transcribing the Program onto Punch Cards

    Each line of code should fit into the 80-column limit of a punch card. If it doesn’t, use additional cards. Almost all COBOL compilers require the area between columns 8 and 72 of the punch card (inclusive) for any code. For our program, it’s okay as each line is less than 64 characters.

    Transcribe the program into individual punch card instructions following your keypunch machine’s guide. For instance, on an IBM029, the ‘A’ key equates to punching holes in rows 12 and 1 of the card.

    Step 4: Punching the Cards

    Feed a punch card into the machine and start punching according to the machine guide you’ve prepared in the previous step. Be meticulous as a single error could render the entire card – or program – useless.

    Step 5: Checking the Cards

    Check to ensure the holes align with your initial instructions. Some keypunch machines include an overpunch key to correct mistakes.

    Step 6: Running the Program

    Stack your cards in order and feed the stack into the reader on your mainframe. The machine should start interpreting the holes precisely as you’ve punched them, and if all goes well, display: ‘Hello, World!’.