Live data from Hacker News

Don't hate COBOL until you've tried it

opensource.com

101–110 of 139 posts

Re: Don't hate COBOL until you've tried it

#101
So, I graduated college this past June and have since started working as a software engineer for a large financial institution. For now, I've been placed on a team of developers where the majority of work is done on mainframes and where most software is written in COBOL.

Today is the last of a 7 week-long "Mainframe Bootcamp" during which I've been introduced to COBOL as well as TSO, JCL, DB2, CICS and MQ. Thus far, I'd say the class has picked up the language fairly quickly, however we've yet to fully grasp the intricacies of development using our company's heavily customized mainframe tools. Generally mundane processes, such as compilation and promotion between environments have been, IMO, rendered tantalizingly complex. It's all really quite tedious and boring. IBM's documentation monopoly hasn't helped, either.

To the point - I question whether COBOL's seemingly polarizing reputation can be somewhat attributed to the environment in which it's usually developed/deployed more-so than the semantic's of the language itself.

Re: Don't hate COBOL until you've tried it

#102
post #4

Earlier quoted context omitted.

The last time I touched it was in undergrad. I remember a professor in my assembly class was showing us old punch cards. They were made with the fancier machines where it printed the line of code on the bottom of the card. I look at the lines in the stack and was like, "Wait, is this ... is this COBOL?" I have to agree. Even back in 2001, I found COBOL awful. I recently moved to a new city after having worked Scala j…

That’s actually quite readable

I’d be curious to see that in Scala — would it be any more readable?

Re: Don't hate COBOL until you've tried it

#103

I worked for one of those companies using COBOL. This strikes me: > Once I discovered what the problem was, the fix was easy: I deleted one character of white space from the beginning of line 19, which put the period at column 72. Although I'd never encountered it before, this was such a common bug that many mainframe COBOL programmers would tape a piece of thread between columns 72 and 73 on their terminals. Why wou…

That 72-character limit came about because the most popular IBM punch card reader at the time COBOL was being written could only read 72 of the 80 characters on a card. Once you know that anything after column 72 will be ignored, you can repurpose those columns for other things. At my shop we used them to denote revision numbers. And once practices like that get set, you're pretty much stuck with the older formatting rules.

Re: Don't hate COBOL until you've tried it

#104
post #72

Earlier quoted context omitted.

Ah. I’ve been downvoted... Guess I should’ve been more clear. I was referencing how the OP said COBOL was easier for data layouts. So, not really knowing COBOL, I was asking why. Poor wording.

The feature we’re talking about here is an easy to use version of doing memory layouts like you’d do with C structs and unions. And combined in with that is automatic number formatting. And all of it uses a clean concise layout that’s self documenting.

COBOL structures are better for fixed-length strings than C structs are because C really prefers strings do be null terminated. In C you've got to specify the length of each string, whereas in COBOL the compiler takes care of that for you.

Re: Don't hate COBOL until you've tried it

#105
post #13

Once in a while I decide I want to play with COBOL, so I install GNU COBOL, dig out my old test code and try to use it to do something interesting. So, most recently I wanted to simply read a file, do some simple processing and then write an output file. Very basic, right? Not so much with COBOL. First you have to statically declare the files you want to use. Let's say you want to read from "foo.txt": environment div…

It's certainly true that there's a lot of boilerplate verbosity involved in reading files in COBOL. But once you've done that, parsing out the fields will likely be much simpler than in most modern languages. Records like this are still produced at government agencies such as the US Census Bureau. I've often wondered if it might be simpler to do the parsing in COBOL and then pipe it to another language to do the rest of the processing.

Re: Don't hate COBOL until you've tried it

#106

So, I graduated college this past June and have since started working as a software engineer for a large financial institution. For now, I've been placed on a team of developers where the majority of work is done on mainframes and where most software is written in COBOL. Today is the last of a 7 week-long "Mainframe Bootcamp" during which I've been introduced to COBOL as well as TSO, JCL, DB2, CICS and MQ. Thus far,…

My experience with COBOL was on Stratus computers running the VOS operating system. This was a better environment than mainframes, but I'm still ambivalent about the language.

Re: Don't hate COBOL until you've tried it

#107

I'm curious about something. Why this: if shipping-method 'FX' move normal-ship-date-yyyymmdd to expected-shipping-date else move nextday-ship-date-yyyymmdd to expected-shipping-date. And not the following? if shipping-method = 'FX' move nextday-ship-date-yyyymmdd to expected-shipping-date else move normal-ship-date-yyyymmdd to expected-shipping-date. The latter seems clearer to me, and the line below (regarding the…

I'm the author of the article, and to be honest the only reason I did it this way was to make sure the period ended up in column 73. I've presented this in talks about half a dozen times now, and you're the first person ever to notice that. Congrats!

Re: Don't hate COBOL until you've tried it

#108

I have not used COBOL for 30 years but the language deserves respect. The transition from assembler to COBOL was one of the biggest productivity improvements in the history of programming, comparable to the introduction of Java and VM-based programs in the 1990s. COBOL is still pretty efficient for tasks like scanning data on magnetic tapes--not that most of us do that any more. In fact it was pretty good for any pro…

> one of the biggest productivity improvements in the history of programming, comparable to the introduction of Java and VM-based programs in the 1990s. If languages like Smalltalk, APL and Lisp aren't counted, then sure, Java was big productivity boost in the history of programming.

I think that the reach of a language need to be considered, as influential and lovable those language might be most of the effect they had was by influencing other languages.

Re: Don't hate COBOL until you've tried it

#109

Earlier quoted context omitted.

> because you could control the data layouts very precisely You can do that in assembly too

Ah. I’ve been downvoted... Guess I should’ve been more clear. I was referencing how the OP said COBOL was easier for data layouts. So, not really knowing COBOL, I was asking why. Poor wording.

COBOL's data types look like they're well-suited to storing fixed-width, hierarchical data, with the format of the data being specified in the data type. The numerical types are oriented toward fixed-point decimal, with explicitly specified levels of precision.

Two variables holding common license plate formats might look like this:

01 LIC-PLATE1 PIC 9A(3)9(3) VALUE '1ABC234'.

01 LIC-PLATE2 PIC 9(3)A(3). VALUE '123ABC'.

[edit: added a newline to separate my examples]

("9" specifies a numerical digit, "A" specifies an alphabetic character, and there are other types that deal with sign, explicit and implicit decimal points, etc).

Assembly deals with memory layouts, but doesn't enforce any kind of higher-level data type, and especially not a human-oriented data specification.

Re: Don't hate COBOL until you've tried it

#110
post #102

Earlier quoted context omitted.

That’s actually quite readable

I’d be curious to see that in Scala — would it be any more readable?

Yes. It's certainly going to be shorter, and if you're familiar with modern programming idioms, also more understandable.
Post reply on HN