View previous topic :: View next topic
|
Author |
Message |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Used with permission, from the CLIST & rexx place.
don.leahy wrote: |
Using END-IF and minimizing period usage makes for much more maintainable code. In my opinion END-IF was the most important innovation made to Cobol in the 30 years I've been in this business. |
I keep thinking of this since Don mentioned it (well, not all the time, so stop giggling about it at the back there). I think he is right. Certainly the feature I used most often.
Code: |
IF (A EQUAL TO B)
PERFORM STUFF-TO-DO-IN-THIS-INSTANCE. (only an eg guys)
MOVE C TO D.
MOVE E TO F.
MOVE G TO H.
END-OF-SECTION.
EXIT.
|
Now, someone would need to make the three moves conditional. Shift to the right for the indent, take the periods off the first two. Compile, run. Mmm... what's gone wrong? Period still on the perform. Or leave one of the periods on one of the moves. Too easy to do if being sloppy, but what can you do about it?
Code: |
IF (A EQUAL TO B)
PERFORM STUFF-TO-DO-IN-THIS-INSTANCE
END-IF
MOVE C TO D
MOVE E TO F
MOVE G TO H
.
END-OF-SECTION.
EXIT.
|
Gone were the days of "End of sentence not preceded by period, period assumed" with the advent of COBOL II. Move the code inside the IF, change the indenting. Bobs your uncle.
Problem was, you could still use periods if you wanted. Still works reasonably well, as the compiler spots the END-IF, now without an IF.
Worse problem. You didn't need to code the END-IF. A period would do.
Simple question after the build-up, two-stage answer. What is the most important change from "old" Cobol until today 1) to aid the production of maintainable code 2) for any other reason you like?
I'm sticking with Don on 1), unless convinced otherwise. For 2) I'm considering Web support as a strategic answer.
Follow-on question. I have more topics if you like. However, I don't want to be a bore. If you don't like these, can you form an orderly queue over by the fire exit? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Here's a short laundry list -
Along the same lines as END-IF, there's always in-line PERFORM (default TEST BEFORE), which is akin to a PL/I DO WHILE (may not execute at all). TEST AFTER is akin to PL/I DO UNTIL (will execute at least once). Both introduced with VS/COBOL II.
Reference Modification (a major improvement). Introduced with VS/COBOL II.
HEX notation. Introduced with VS/COBOL II.
Easy handling of variable length files in Batch (many posts on the forum about this subject). Introduced with VS/COBOL II.
INSPECT WITH LITERALS (Resolves in-line as a single TR instruction). Introduced with VS/COBOL II.
COBOL FUNCTIONS (Introduced with COBOL/370, the successor to VS COBOL II).
PROCEDURE POINTER (load an external program/table into memory - similar to an MVS LOAD Macro). Introduced with COBOL/370.
Language Environment integration (introduced with COBOL/370 as well).
COMP-5 Binary (Introduced with OS/390 COBOL 2.2.1). TRUNC option has NO EFFECT. Also known as Native Binary.
Bill |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Quite a list.
I'll assume you mean the in-line stuff for the maintainable code? OK as long as it doesn't come over all Pascal.
Can I coax you into one "other". Reference modification, maybe? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Best inovation:
end construct
expansion of file-status
things that should be removed from cobol:
declaratives.
read .... at end |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK.
Trouble with a list of things to be removed is that no-one ever takes any notice of us. At least with things that have been added, we can talk about something real.
However, I'd not miss declaratives either. With the file-status, AT END is a bit pointless, isn't it?
It is also funny. With IBM Cobol, nothing is removed for years. Then they take an axe to a whole chunk. I miss my "IBM extention"s. Some, anyway. |
|
Back to top |
|
|
|