- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
COMPLEX * 16: FRIST
The FORTRANNER still hasn't transitioned to mixed case because their hammer-print line printer only supports upper case!
Admin
Ah, FORTRAN. Call me crazy but I like it. Than again I consider x86 Assembly to be a fun toy language to fool around with in my spare time. So I might just be crazy.
Admin
Shouldn't that be 132 columns wide? (I admit it's been a while)
Admin
But but but... any common programming language can print to 132-column paper.
Admin
132 column fanfold green bar papers still haunts me. As does FORTRAN. The idea that someone may be using Oracle in addition to FORTRAN makes me shudder.
Admin
Real Programmers do List Processing in Fortran. Real Programmers do String Manipulation in Fortran. Real Programmers do Accounting (if they do it at all) in Fortran. Real Programmers do Artificial Intelligence programs in Fortran.
https://www.pbm.com/~lindahl/real.programmers.html
Admin
No. Real programmers do all that in Excel. For it is the goods own tool.
Admin
It doesn't have to be in Fortran to be on fan-fold paper. It could be more a matter of the entire application system being architected around batch processes.
Admin
No, no, NO! TRWTF is not knowing that you can use ANYTHING to print á la chunka-chunka-chunka -- that is, if you know how printing works ...
Admin
Couldn't you just put a conditional formatting formula on an Excel sheet and call it a day?
Admin
I think you're right. I recall 132 also with the green-bar paper and perforations. When I was younger, the old programmers would print out a program on one of these guys so they could, in good conscience, go take a smoke break while it was printing... for 20 minutes or so.
Admin
I think, it's well in the spirit. You know, back then when real programmers were paid per LOC…
Admin
I'll second Bananafish in that you can print to things that don't look like modern printers. I have some code here that prints to an industrial label printer--raw mode, simply a byte stream. Works fine.
That being said, this isn't quite as evil as it at first looks--at least in the old days Fortran had short limits on significant characters in labels. You had to use yucky names like this. I don't know if it's still that way since I haven't touched it in almost 40 years.
Admin
I was thinking the same thing, and it's certainly true. However, there was a mainframe era convention for line printers where the first character of each line was in fact a control byte to the printer, and not actually printed. SPC => a normal line; "1" => skip to new page, "2" => skip to next half page; "+" => don't advance to the next line, allowing over-striking. if that's not being taken care of by a port, then any output with digits in the first column can cause literally reams of output.
Admin
Yes, 132 columns. But the FORTRAN printer record was 133 columns wide. The first column was the carriage control character -- '1' to throw a new page, '0' to skip a blank line, space to not skip any lines at all, '+' to overwrite the previous line. If you didn't realize this and blindly printed a lot of numbers that started '1', you would use up a lot of paper.
Admin
it would make sense to check for the first character in case there are many options sharing the same character (like later in the example), yet you would want to use ELSE IF to avoid checking the character again if you already found amatch.
Lookup tables or hash tables would be another option, but probably nothing you would do in FORTRAN.
Admin
Huh... when was that written?
I am working on an actively developed industrial Fortran code base, and I haven't seen a common block in a while, except when touching really old code that sits on a "what works works" basis in separate repositories. Modern-day Fortran has no need for common blocks, even if it wants to use globals.
That aside, how did they manage to use a common-block variable in the parameter list? If I try that, it gives me a compile time error about conflicting attributes.
As for the string stuff... Fortran has no real strings and predates the "0-terminated character array" convention of C. So Fortran's multi-dimensional-array minded solution is to have fixed-length character arrays, padded with spaces. This convention extends to comparison: In Fortran
is
.true.
. So all those comparisons== 'STR1NG '
are probably not checking, what the programmer thought the are checking. That said, our own codebase had things likedata(1:4) == 'true'
, when justdata == 'true'
would have sufficed, and likely have been more correct.As for the rest... The cryptic variables seem to mirror the names in the database, so the cryptic names probably make sense in the context, or were badly named in another place, not the Fortran code, originally.
But yes, that subroutine screams writing some subroutine to do the recurring stuff. And the long else-if chain could be replaced by a
SELECT CASE
for better readability. But given the context that was given, and the overall Syntax, it is entirely possible their compiler doesn't even support it. According to IMB's documentation, theSELECT CASE
syntax was only added as of Fortran 90.So to get to TRWTF: Insisting on using extremely outdated compilers for all the wrong reasons.
Admin
Yes, but, unless there's some really clever optimisation, you will be checking the first character again for each of the subordinate IF
s. What you really need to do is check the first character and then check the second character onwards inside the
IF`.Addendum 2023-05-09 05:15: Missing backquotes. Sorry.
Admin
Aah, printing. Using ESC codes to move printhead around. Superscript and subscript. Chemical formulas. All in Fortran and on line printers. All using ESC codes to get things right :-)
Admin
There are already couple of really useful instrinc Fortran functions for such operations. Apparently Matt’s replacement was not particularly familiar with whole capabilities.
Last but not least, instead of subroutines, functions approach would make more sense.
Best.
Admin
That's real old school. IBM sold mixed case line printers for many years.
Admin
The question is, are we talking FORTRAN 77, which is the thing haunting the comment section, or modern Fortran, which, more or less like C and C++, has new standard versions every few years, free-form syntax, OOP, built-in parallelism, whole-array operations and other conveniences? Judging by the mention of the COMMON block, I'll guess it's the former. In Fortran ≥ 90, one would implement that in a safer manner using modules.
Admin
Real computer paper comes on rolls!!!!!! [as I sit at my ASR-33 teletype]
Admin
Crikey, this one must have been one of mine. It must date from many years ago, because I cannot remember posting it. And here it is, appearing in TDWTF in the middle of a week of my holiday, which is why it's only now it reaches me.
I know it's one of mine because I recognise the code signature, starting as it does with AASTAT.
There's still some good money in FORTRAN, as I have discovered to my advantage recently, but I don't know for how long.
Admin
There are still commercial code bases in Fortran that are so substantial that they're never going away, because they would cost way too much to rewrite in a more chic language.