# Explicit vs Implicit termination

**URL:** <https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688>\
**Category:** COBOL technical questions\
**Created:** [April 10, 2020, 7:27pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688 "2020-04-10T19:27:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnold](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@Arnold](https://community.openmainframeproject.org/u/Arnold)\
**Post date:** [April 10, 2020, 7:27pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/1 "2020-04-10T19:27:12Z")

</div>

I’m revisiting some old assignments and I’m seeing a distinction between implicit (.) and explicit (letting the code structure terminate the block of code itself. I’m wondering if there is any performance reason to code one way or the other, or is it all just for style points that will get built the same way by the assembler?

---

<div class="post-metadata">

**Author:** ![archangel](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.openmainframeproject.org/archangel/32/180_2.png) [@archangel](https://community.openmainframeproject.org/u/archangel)\
**Post date:** [April 10, 2020, 9:11pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/2 "2020-04-10T21:11:53Z")

</div>

Hi Arnold: I’ve taught COBOL and Assembler since the 1980s. My principle is to always retain explicit control of the program flow, and clean up after yourself. That means that you always use explicit terminations, release memory that’s been requested when you’re done with it, and other similar rules. They have always avoided unexpected results, where the code could do something you didn’t anticipate. I’ve corrected many programs over the years who thought they had an implicit termination or change of flow, only to find that the code simply dropped through to the next instruction regardless. It’s always better to KNOW that the code will flow as you have programmed it, and the only way to be 100% sure is to code it explicitly. It’s also good style, but with a purpose.

Hope that helps!

Mark D’Gabriel

---

<div class="post-metadata">

**Author:** ![Arnold](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@Arnold](https://community.openmainframeproject.org/u/Arnold)\
**Post date:** [April 10, 2020, 9:32pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/3 "2020-04-10T21:32:09Z")

</div>

Thank you Mark that definitely helps. Appreciate the insight.

---

<div class="post-metadata">

**Author:** ![escotthei](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.openmainframeproject.org/escotthei/32/182_2.png) [@escotthei](https://community.openmainframeproject.org/u/escotthei)\
**Post date:** [April 10, 2020, 9:51pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/4 "2020-04-10T21:51:55Z")

</div>

Explicit termination wasn’t introduced until Cobol '85, right? A lot of implicit termination may indicate the age of the code… Agree?

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://community.openmainframeproject.org/u/Robert)\
**Post date:** [April 10, 2020, 11:25pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/5 "2020-04-10T23:25:00Z")

</div>

COBOL was designed before the concepts of structured programming were understood, and while it has caught up, implicit termination is a relic of this time. Perhaps because I came to COBOL after PL/I, I always use explicit termination, and this is the standard that I’ve built into MANASYS Jazz ([https://jazzsoftware.co.nz/](https://jazzsoftware.co.nz/)). Any reasonable COBOL compiler will generate the best code possible from either form (and IBM’s COBOL compiler is especially good), and even if there were a code penalty I’d advocate explicit termination because it creates programs that are more obviously correct. To a programmer like me trained first in a more regular language, COBOL’s syntax is quirky and leads to unexpected errors.

Robert Barnes

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://community.openmainframeproject.org/u/Robert)\
**Post date:** [April 10, 2020, 11:25pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/6 "2020-04-10T23:25:44Z")

</div>

Correction - Any reasonable COBOL compiler

---

<div class="post-metadata">

**Author:** ![COBOL](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@COBOL](https://community.openmainframeproject.org/u/COBOL)\
**Post date:** [April 11, 2020, 1:40pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/7 "2020-04-11T13:40:38Z")

</div>

Implicit termination of code structures is a very common technique in many COBOL programs. “Structured” programming techniques usually rely on the implicit termination of “paragraphs” as a means of easy code control. “Non-structured” programs, which are often referred to as “spaghetti code”, are more reliant on terminators or branching verbs to control program flow.

Implicit or explicit use of terminators produces very little difference in the performance of the code. Most COBOL compilers are very good at creating efficient and fast execution code regardless of implicit versus explicit terminators. Most compilers have additional parameters that can be used to further optimize the generated code if required. Under general circumstances this is usually not necessary.

For structured programs I recommend the use of implicit terminators. This keeps the code cleaner and easier to understand. For programs that are not well formed it is sometimes necessary to use explicit terminators to accomplish the necessary code modification without major structure changes to the code.

If you are still reading…  
Most COBOL systems use a technique where the code is “programmed” in a human readable format that utilizes “words” arranged in “sentences” and “paragraphs”. The sentences are terminated by “periods” just like a story written in english. This “story” is the COBOL “program”. The “program” is then processed by a “compiler” which reduces the human readable code into an efficient mass of bit and bytes known as “object code” or “intermediate byte code”. The output of this compilation step creates a file separate from the original programming code. It is this separate file that is used by the processing system to produce the end result the program was designed to accomplish.

In comparison many currently popular programming languages (like Javascript) use a “just in time” (JIT) method of interpreting the human readable code and changing it the machine executable instructions that the computer can utilize. This technique means there is not a visible compiler used in the process. The “compilation step” occurs at execution time. In terms of machine cycles this can be a time consuming step. Since COBOL has performed part of this step as part of the programming step the result is that COBOL code can run fast and efficient and not be subject to some of the issues faced by JIT code techniques. It is also part of what allows COBOL programs to continue to run for decades without changes to the code. It also allows some COBOL program to run in different environments such as mainframes and PC’s with little or no change to the actual program code.

I hope this helps.

---

<div class="post-metadata">

**Author:** ![bootonb](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.openmainframeproject.org/bootonb/32/222_2.png) [@bootonb](https://community.openmainframeproject.org/u/bootonb)\
**Post date:** [April 11, 2020, 3:32pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/8 "2020-04-11T15:32:23Z")

</div>

Nothing wrong with both 😉

```
IF condition
    do this
END-IF.

```

I liked the addition of explicit terminators, but I’ve been writing COBOL for so long that a statement just doesn’t look right to me without a period at the end.

---

<div class="post-metadata">

**Author:** ![coseos](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.openmainframeproject.org/coseos/32/384_2.png) [@coseos](https://community.openmainframeproject.org/u/coseos)\
**Post date:** [April 13, 2020, 9:01am UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/9 "2020-04-13T09:01:58Z")

</div>

You can use implicit and explicit termination. I would always prefer explicit termination as this supports the concept of (COBOL) sentences/statements very well. Always add a period at the end of a sentence/statement - as you would in your natural language. Always use END-… (END-IF, END-PERFORM, END-EVALUATE, …). Nobody would seriously recommend to write a text without correct punctuation.

---

<div class="post-metadata">

**Author:** ![Burnie](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@Burnie](https://community.openmainframeproject.org/u/Burnie)\
**Post date:** [April 13, 2020, 6:27pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/10 "2020-04-13T18:27:24Z")

</div>

I started programming in 1967 … COBOL in 1968 (along with many other languages through the years) until I retired in 2004. Most of the time I spent as a contractor in Massachusetts in a variety of industry types.  
In all those years, I never heard the terms Implicit or Explicit termination … also, taught a number of COBOL courses … where my favorite response to a debugging question was “You forgot a period”.  
At my current age of 85, it’s not practical for me to volunteer as a COBOL programmer (most would undoubtedly think that at my age I can’t think clearly anyway). However, I’ll keep my eye on this forum and if I can help in any way, I will.

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://community.openmainframeproject.org/u/Mik)\
**Post date:** [April 13, 2020, 7:55pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/11 "2020-04-13T19:55:23Z")

</div>

The whole point of COBOL was to be English-like and readable. Use of periods and structuring your code appropriately - separating functions, etc, lends itself to that quite well.

I always endeavored to make my code clean, structured, efficient and stable. If it went down unexpectedly there were always sufficient breadcrumb trails consistently in the same places where one could find out where the program was and what data it was looking at. If I detected something wrong and had to abend the program there was always an explicit report in the run logs that told you exactly what happened on what input record or DB call, why it was bad and if possible what to do to fix it and finish the run. Those things are pretty easy to do if you set up the structure right the first time.

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://community.openmainframeproject.org/u/Mik)\
**Post date:** [April 13, 2020, 8:00pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/12 "2020-04-13T20:00:35Z")

</div>

Mark, also a former assembler guy here and I ran across that all the time where code would just fall through because they did not trap properly - they just assumed the data would always look a certain way.

Since you teach I have to relay a story. I was already an experienced COBOL guy when I took some college courses in assembler on Saturdays. My teacher was BRILLIANT, just a total whiz at it.

Then I started going up to his desk t get help on assignments and every time I did his breath reeked of marijuana. Not only was he brilliant, but quite stoned as well!

---

<div class="post-metadata">

**Author:** ![dc\_123](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@dc\_123](https://community.openmainframeproject.org/u/dc_123)\
**Post date:** [April 13, 2020, 8:28pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/13 "2020-04-13T20:28:50Z")

</div>

I don’t use them periods. Here is why. It forces you to you explicit scope terminators such as end-if and end-read. If you are modifying existing code, you should either use or not use periods depending on how the rest of the code is written, just so that it is is consistent. If the code is inconsistent do whatever is the clearest. AND ALWAYS USE END-IF

---

<div class="post-metadata">

**Author:** ![DJM](https://avatars.discourse-cdn.com/v4/letter/d/7feea3/32.png) [@DJM](https://community.openmainframeproject.org/u/DJM)\
**Post date:** [April 14, 2020, 8:09pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/14 "2020-04-14T20:09:47Z")

</div>

I have coded in COBOL since 1979 and always used Explicit (periods) termination. I cannot speak for it prior to 1979.

---

<div class="post-metadata">

**Author:** ![archangel](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.openmainframeproject.org/archangel/32/180_2.png) [@archangel](https://community.openmainframeproject.org/u/archangel)\
**Post date:** [April 15, 2020, 1:01am UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/15 "2020-04-15T01:01:40Z")

</div>

Hi Michael:

Thanks for your message… I love it! Just proves that programming has an artistic side as well as scientific.

I finished my undergrad degree at nights over many years, while I was working. The best course I ever took was on machine architecture… we started with Boolean algebra, built up the basis for digital processing components, then the 2nd term of the course was Assembler programming. The guy who taught us was frighteningly brilliant – he freelanced low-level code fixes to IBM operating systems and software like CICS, and he did it all IN HIS HEAD! One day he announced that he wouldn’t be there for the 2nd mid-term exam and another prof would be present that one week only. Turned out he was the president of the Toronto Blue Jays Fan Club, and he NEVER missed the opening day game of spring training!

If you’ve never read it, I very highly recommend a Pulitzer prize winning book called “The Soul of a New Machine” by Tracy Kidder. It’s one of my all-time favourites and I’ve read it at least 20 times over the years. If you’ve already read it, you’ll know why I say that!

Happy coding!

**Mark D’Gabriel**  **PMP**

_This email, including any attachments, is for the sole use of the intended recipient and may contain confidential information. If you are not the intended recipient, please immediately notify me by reply email or by telephone, delete this email and destroy any copies. Thank you._

---

<div class="post-metadata">

**Author:** ![DaveS](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@DaveS](https://community.openmainframeproject.org/u/DaveS)\
**Post date:** [April 17, 2020, 10:37pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/16 "2020-04-17T22:37:15Z")

</div>

I’m retired now, but coded in COBOL, assembler, PL/1 and finally C#. Unfortunately, the end of my career involved moving a massive legacy system to a server based system. This was done using .Net and C#, SQL Server. etc. I actually became a fan of that environment, but not the migration.

My COBOL team ascribed to the philosophy that there was only ONE period in any paragraph on the EXIT statement. ALL block structures need to use the END termination, on its own line, with all lines in the block indented.

This eliminates all the old bugs from an extra period, or missing one.

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://community.openmainframeproject.org/u/Mik)\
**Post date:** [April 18, 2020, 12:53pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/17 "2020-04-18T12:53:25Z")

</div>

Mark, I did read that, way back wen it first came out in 82 or 83! I was in school studying on a PDP-11. I remember the phrase ‘I’m not putting a bag on the Eclipse!’. Lots of drama over designing a new computer. I suspect it is that way to this day.

---

<div class="post-metadata">

**Author:** ![payter](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.openmainframeproject.org/payter/32/303_2.png) [@payter](https://community.openmainframeproject.org/u/payter)\
**Post date:** [April 18, 2020, 5:27pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/18 "2020-04-18T17:27:49Z")

</div>

Sounds like the sanest behavior.

Requiring the explicit `END` compares to mandating [both] curly-braces in `C`-like languages, avoiding confusions like the one mentioned [in this IBM reference](https://www.ibm.com/support/knowledgecenter/SS6SG3_6.3.0/pg/concepts/cppgm42.html) article. Makes for easier reading and comprehension.

It’ll also be familiar to folx coming from other languages … `ruby` first comes to mind, but pretty much pick one. Except python, but then python _requires_ indentation to indicate code level.

---

<div class="post-metadata">

**Author:** ![DaveS](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@DaveS](https://community.openmainframeproject.org/u/DaveS)\
**Post date:** [April 18, 2020, 8:22pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/19 "2020-04-18T20:22:32Z")

</div>

Yes, COBOL caught up with other languages in many ways, like MixedCase variable names, object oriented structures, etc.

---

<div class="post-metadata">

**Author:** ![lakshmisudha](https://avatars.discourse-cdn.com/v4/letter/l/a3d4f5/32.png) [@lakshmisudha](https://community.openmainframeproject.org/u/lakshmisudha)\
**Post date:** [April 20, 2020, 12:08pm UTC](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688/20 "2020-04-20T12:08:38Z")

</div>

Hi ,  
You are an inspiration for many programmers like me. Age is not a barrier and we welcome your thought process, to contribute for this community.  
Yes, COBOL is English like, period was the terminator initially, but later due to readability and the advent of other languages, explicit terminators become popular.  
Regards  
Lakshmisudha

[Next page](https://community.openmainframeproject.org/t/explicit-vs-implicit-termination/688.md?page=2)
