Love to see fixed format mode in use :)

For those who are unaware — you can use COBOL in two modes: free mode and fixed format mode.

Fixed format mode is (afaik) the original, based on punch card affordances, and specifies specific columns for specific purposes:

* The first 6 columns for line numbers

* Column 7 for the indicator character (notably: * for comments as you can see here https://github.com/jmsdnns/webbol/blob/main/file-structs.cpy )

* Column 8-11 for special division markers, though they can extend beyond (visible in this file: https://github.com/jmsdnns/webbol/blob/main/webserver.cbl)

* Columns 12-72 for ordinary COBOL statements

* Columns 73-80 for programmer comments or whatever notes you like

All the columns are undoubtedly a bit taxing to the modern developer and their tools, so 'free mode' which discards all the above is the suggested default.

But, I think fixed mode is very charming, and if you're going to write COBOL in 2025, you may as well try to get the most authentic experience!

Cols 73-80 were sometimes used for sequence numbers so when you spilled your cards on the floor you could run them through the sorting machine.

This may help you get the feel (pick the COBOL card at the top). [0]

For an even more authentic experience, write the program on a coding form first, then give it to an assistant for keypunching. [1]

[0] https://www.masswerk.at/keypunch/

[1] https://www.mainframestechhelp.com/tutorials/cobol/coding-sh...

Early versions of Fortran also had a fixed column layout, although the columns were different. The only commonality thst I can find right now is ignoring columns 73 to 80 to make space for card sequence numbers.

I never wrote a program on punch cards, but I'd definitely drop card stacks accidentally or get them into a jumble somehow. Having numbered cards and a card sorting machine (radix sort in hardware!) would be extremely helpful then.

Old-timer tip: take a marker and draw a diagonal line across the top of your card deck, from the column 1 left side edge of the first card to the column 80 right side edge of the last card. When you drop the deck, just reassemble the line.

Which sorting algorithm do you use when reassembling? Does it work well with "eyeball it and stick it near correct-ish spot and then fiddle with it later"?

Depends how much bleed your paper has with your marker, but in general it’s quite accurate to eyeball it. I’ve never used it on punch cards, but I have for large documents.

I liked this too, but interesting that the Makefile uses the `-free` flag for cobc

I assume fixed is a subset of free? So perhaps a few lines somewhere aren’t perfect.

the code is similar to fixed format, but the location of the comments gives away that it is actually in free format.

* comments use *> at start of line, though I'm not sure i'll keep that

* indentation is flexible, but i prefer how fixed looks

* no column restrictions

[deleted]