MadSci Network: Computer Science |
Hello! COBOL, eh? I wonder why…all right, here goes… COBOL was an effort to make a programming language that was like natural English, easy to write and easier to read the code after you'd written it. The earliest versions of the language, COBOL-60 and -61, evolved to the COBOL-85 standard sponsored by the Conference on Data Systems Languages (CODASYL). COBOL (Common Business-Oriented Language) was developed around 1960 by several computer manufacturers and the Pentagon, making it one of the longest-lived computer programming languages. Even though updates have been produced for COBOL, many serious programmers consider the language out-of-date. Most of what COBOL was used for was database-oriented programming, though it didn’t have any search-and-retrieve modules for record criteria like dBASE or SQL. You could lay out an output format for the database, act on certain fields within the records, perform extremely basic mathematical functions (the basic four, I think was all) then print it out. (In 1975 when I first learned COBOL, these were 132-column line printers; huge, clunky, and nightmarish things. Woe to the person who got to close to an open and active printer with a tie on!) Or you could store the output to magnetic tape or hard disks (which bear almost NO resemblance to what we use today!) The reason why COBOL is not used much today is because it is over-verbose (requiring some three dozen lines of code to do something Perl or C++ could accomplish in two or three lines), hard to maintain (no simple fixes in this language). Let’s see an example of this, shall we? COBOL: IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD. * THIS PROGRAM PRINTS "HELLO WORLD" ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. 01 HEADER-1. 05 FILLER PIC X(13) VALUE "Hello, World!". 05 FILLER PIC X(119) VALUE SPACES. PROCEDURE DIVISION. 100-MAIN-MODULE. WRITE HEADER-1 STOP RUN. PERL: #!/usr/bin/perl print "Hello, world!"; exit; <--this is even optional What looks easier to you, then? And of course it goes without saying that COBOL is about 70% responsible for the Year 2000 (Y2K) computer situation. Many dinosaur (pre-1980) mainframes had COBOL programs written back in the late 50s to early 70s that worked well enough for what they were supposed to do (payroll, employee reports, that sort of thing). And, of course, many management units (be nice!) thought that since the programs and equipment worked, there was no need to change/upgrade. Until the last two or three years. About the only reason why anyone would study COBOL today is to understand it well enough to convert it into a more up-to-date language (again, like Perl or C++) and alleviate any Y2K problems or make things like database design/implementation more flexible (and a lot of people have made a lot of money because of this). Not to mention that COBOL is almost completely incompatible with anything Internet-related (except for one or two claims from COBOL products I see on the Internet), so again there’s that conversion factor for programming. Nonetheless, COBOL compilers (interpreters, really) are still available for PC, Mac, UNIX, LINUX, DOS, and OS/2. I have no idea why. Try http://www.cobol.com/ for some more details I might have missed. This should be enough to start you out, though if you want a recommendation as to what programming language would be good to learn today, I would recommend C++ first (it’s near-universal, though tricky to learn), maybe Java (it’s still very new and has exceptional power as both a standalone and Internet programming language, though still tricky), definitely Perl (Everything COBOL can do is maybe about five percent of what Perl can do. Database programming becomes extremely easy with Perl, and it is comparatively easier to learn than C++ or Java), and perhaps Visual Basic (which I don’t really use). With any two of those four languages you’re not going to be out of work for long… As for how to adjust a COBOL program on the Macintosh, I suspect it's probably a question of adjusting names for readable/writeable media (file systems are addressed quite a bit differently on a Mac than an IBM, and it'd be the same if you were trying a UNIX/LINUX-based program). Again, check the website above or communicate with them and they can give you more details for your specific COBOL compiler (pcobol?). use “Disclaimer::Standard”; Hope this helps! Steve Laybourn
Try the links in the MadSci Library for more information on Computer Science.