# MCG pitfalls

**URL:** <https://techcommunity.softwareag.com/t/mcg-pitfalls/60167>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [September 14, 2005, 5:56pm UTC](https://techcommunity.softwareag.com/t/mcg-pitfalls/60167 "2005-09-14T17:56:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnc](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@johnc](https://techcommunity.softwareag.com/u/johnc)\
**Post date:** [September 14, 2005, 5:56pm UTC](https://techcommunity.softwareag.com/t/mcg-pitfalls/60167/1 "2005-09-14T17:56:47Z")

</div>

Hi there,

Can anyone tell me in a nutshell if there are any negative ramifications to using the Optimized Compiler option (MCG) across the board. We have just used it on two programs and in the one case the CPU utilization was improved by 13%, and in the other by 86%!.

Neither of these used ADABAS, but the improvement is still substantial.

Should we just use it for everything, or like Prefetch, is it something which we should take on a case by case basis?

Regards

John

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [September 14, 2005, 6:33pm UTC](https://techcommunity.softwareag.com/t/mcg-pitfalls/60167/2 "2005-09-14T18:33:35Z")

</div>

The only drawback, if you will, is the increased size of the GP, besides that you shouldn’t see any kind of negative impact when using it “for everything”.

---

<div class="post-metadata">

**Author:** ![Chad\_Scott](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@Chad\_Scott](https://techcommunity.softwareag.com/u/Chad_Scott)\
**Post date:** [September 17, 2005, 12:12am UTC](https://techcommunity.softwareag.com/t/mcg-pitfalls/60167/3 "2005-09-17T00:12:05Z")

</div>

Actually there can be some drawbacks IF you aren’t carefull with some of the options. I know there some bugs which have been addressed in v4 (we are still at Nat3.1.6 NOC2.3.7), but the general idea still applies.

It mostly comes down to poor Natural coding practices, but some examples are:

Index range checking - if turned off and range checking is not done in the program then other memory can be accessed that isn’t actually for the array.

Numeric checks - (bug?!?) invalid data can be stored in numeric fields as a result of redefines which include both alpha and numeric fields if certain options used. I.E.  
DEFINE DATA  
LOCAL  
01 #ALPHA (A10)  
01 REDEFINE #ALPHA  
02 #NUMBER (P5.1)  
01 #RESULT (N6.1)  
END-DEFINE  
\*  
#RESULT := #NUMBER  
END  
With certain options this will not cause an OC7, even though #NUMBER really doesn’t contain a valid packed value.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [September 17, 2005, 1:48am UTC](https://techcommunity.softwareag.com/t/mcg-pitfalls/60167/4 "2005-09-17T01:48:57Z")

</div>

That’s right, these problems have been addressed.

But the way I interpreted the original question was if there’s a potential for performance degradation when turning NOC on globally.

---

<div class="post-metadata">

**Author:** ![Chad\_Scott](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@Chad\_Scott](https://techcommunity.softwareag.com/u/Chad_Scott)\
**Post date:** [September 19, 2005, 9:06pm UTC](https://techcommunity.softwareag.com/t/mcg-pitfalls/60167/5 "2005-09-19T21:06:33Z")

</div>

Hi Wolfgang,

Just to clarify, are you saying that with index range checking turned off there is no longer a chance to access memory locations not allocated to the array?

Didn’t mean to disagree with you, just interpreting for a bigger picture 😉

---

<div class="post-metadata">

**Author:** ![Jon\_Russell](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@Jon\_Russell](https://techcommunity.softwareag.com/u/Jon_Russell)\
**Post date:** [September 21, 2005, 3:22pm UTC](https://techcommunity.softwareag.com/t/mcg-pitfalls/60167/6 "2005-09-21T15:22:44Z")

</div>

Going back to Johnc’s original question, I would agree that in general it is better to switch on MCG across the board. You may need a larger bufferpool, but you should always get some performance benefits

However, as Chad said, you need to carefully think about what MCG parameters to use. In my opinion INDX,OVFLW should always be used without exception. (I have spent many happy hours looking at dumps where storage corruption has been caused by index out of range conditions!)

Regarding the question of whether an 0c7 is caused by the assignment of invalid packed data. I recently came across the DIGTCHCK parameter with NOC41. This will add an extra check on assignment of packed/numeric fields which will cause an abend on invalid data (as Natural already does by default).

Regards  
Jon

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [September 21, 2005, 10:31pm UTC](https://techcommunity.softwareag.com/t/mcg-pitfalls/60167/7 "2005-09-21T22:31:52Z")

</div>

> [@ChadScott](#):
>
> Just to clarify, are you saying that with index range checking turned off there is no longer a chance to access memory locations not allocated to the array?

Sorry, missed this question…

No, this can still happen with index checking off.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:40pm UTC](https://techcommunity.softwareag.com/t/mcg-pitfalls/60167/8 "2021-04-02T14:40:17Z")

</div>


