Live data from Hacker News

Learning COBOL: A Journey for the Modern Programmer

monadical.com

1–10 of 63 posts

Re: Learning COBOL: A Journey for the Modern Programmer

#2
I remember the government's plea for COBOL programmers last year and was surprised we haven't seen that many more posts about it since then.

https://nymag.com/intelligencer/2020/04/what-is-cobol-what-d...

https://onezero.medium.com/our-government-runs-on-a-60-year-...

Just this one yesterday:

https://www.govtech.com/opinion/An-Apology-to-COBOL-Maybe-Ol...

Re: Learning COBOL: A Journey for the Modern Programmer

#6
Looking at COBOL code such as

   PERFORM N TIMES
     ADD 1 TO I
     DIVIDE X2 INTO 1500 GIVING Y
     SUBTRACT Y FROM 815 GIVING Y
     DIVIDE X1 INTO Y
     MOVE X1 TO X2
     SUBTRACT Y FROM 108 GIVING X1
     DISPLAY I'|'X1
    END-PERFORM.
I wonder if someone has written a Python-to-Cobol translator so that you can program using regular math notation and then translate that into wordy Cobol.

Re: Learning COBOL: A Journey for the Modern Programmer

#7
But which COBOL? Microfocus now own RM/COBOL and AccuCOBOl, as well as their own MicrFocus Cobol. These are for the IBM PC and run on Windows, Unix, and Linux. Old code usually uses compiler dependent extensions, and without a good amount of work, I can not just recompile using a diffrent vendor's cobol. And if it does happrn to compile it may not work because the expected behaviour of implrmented language key words might be slightly diffrent. I ran inro this trying to port code to GNUCobol

Re: Learning COBOL: A Journey for the Modern Programmer

#9

Looking at COBOL code such as PERFORM N TIMES ADD 1 TO I DIVIDE X2 INTO 1500 GIVING Y SUBTRACT Y FROM 815 GIVING Y DIVIDE X1 INTO Y MOVE X1 TO X2 SUBTRACT Y FROM 108 GIVING X1 DISPLAY I'|'X1 END-PERFORM. I wonder if someone has written a Python-to-Cobol translator so that you can program using regular math notation and then translate that into wordy Cobol.

Maybe it's because I'm not a native English speaker but what does "divide into" mean?

Re: Learning COBOL: A Journey for the Modern Programmer

#10

Looking at COBOL code such as PERFORM N TIMES ADD 1 TO I DIVIDE X2 INTO 1500 GIVING Y SUBTRACT Y FROM 815 GIVING Y DIVIDE X1 INTO Y MOVE X1 TO X2 SUBTRACT Y FROM 108 GIVING X1 DISPLAY I'|'X1 END-PERFORM. I wonder if someone has written a Python-to-Cobol translator so that you can program using regular math notation and then translate that into wordy Cobol.

> I wonder if someone has written a Python-to-Cobol translator so that you can program using regular math notation and then translate that into wordy Cobol.

Yes. But worse. And used in the real world.

Whilst I cannot give all the details for obvious reasons, when I was assisting a particular bank with translating some of their stack from COBOL to modern Fortran, part of the problem was that a large amount of their COBOL code was actually generated.

It wasn't a Pythonish-to-COBOL, though. It was a mix of the C-preprocessor and Bash that generated the COBOL code.

(Problem for me was that all source code was printed, and not stored anywhere digitally, so I had to restore that evil Bash/CPP script just to be able to restore the code I had to retype by hand).

Post reply on HN