# Mainframe vs Windows - Errors.

**URL:** <https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Linux, Natural-on-Windows-Unix\
**Created:** [April 27, 2015, 2:16am UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666 "2015-04-27T02:16:14Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![JB\_Newbie](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jb_newbie/32/537_2.png) [@JB\_Newbie](https://techcommunity.softwareag.com/u/JB_Newbie)\
**Post date:** [April 27, 2015, 2:16am UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/1 "2015-04-27T02:16:14Z")

</div>

Sorry, hopefully I am posting this in the correct location. I am using Natural within Windows:  
Software AG Natural for Windows. – Version 6.3.14 PL 0

Mainframe vs Windows - Errors.

I have a Natural program that I am able to view either within my windows environment or on the mainframe. Both locations STOW correctly. However, when you view the program within the windows environment, the +/- for a FOR and IF statement are both highlighted in red.

Is it possible for a program to STOW ok, yet still have problems with a statement? I can’t find any other information for this indicator within the environment.

Attached & below is an example. So there may be problem with the way this - FOR and IF statement are setup that I am not seeing yet…? I’m assuming that is why there is a red box next to those parts of the code… Sorry, still new to this.

4860 - FOR #AA = 1 TO 6  
4862 - IF #H-BUDGET(#AA) \> ’ ’  
4864 EXAMINE #BUDGET-ARRAY(\*) FOR #H-BUDGET(#AA) GIVING INDEX #BB  
4866 IF #BB \> 0 AND  
4868 #H-FUND(#AA) = #FUND-ARRAY(#BB) AND  
4870 #H-OBJ-CAT(#AA) = #OBJ-CAT(#BB)  
4872 ADD #H-OBJ-CAT-AMT(#AA) TO #OBJ-CAT-AMT(#BB)  
4874 \*\* ADD #H-OBJ-CAT-AMT(#AA) TO #WORK-INCM.#AMNT-BUDG-ADJ(#BB)  
4876 ELSE  
4878 ADD 1 TO #CC  
4880 MOVE #H-BUDGET(#AA) TO #BUDGET-ARRAY(#CC)  
4882 MOVE #H-FUND(#AA) TO #FUND-ARRAY(#CC)  
4884 MOVE #H-OBJ(#AA) TO #OBJECT-ARRAY(#CC)  
4886 \*\* MOVE #H-OBJ(#AA) TO #WORK-INCM.#CODE-BUDG-ADJ(#CC)  
4888 MOVE #H-OBJ-CAT(#AA) TO #OBJ-CAT(#CC)  
4890 ADD #H-OBJ-CAT-AMT(#AA) TO #OBJ-CAT-AMT(#CC)  
4892 \*\* ADD #H-OBJ-CAT-AMT(#AA) TO #WORK-INCM.#AMNT-BUDG-ADJ(#CC)  
4894 END-IF  
4896 ELSE  
4898 ESCAPE BOTTOM  
4900 END-IF  
4902 END-FOR

Thank you in advance.  
 ![ErrorExample.png](https://global.discourse-cdn.com/techcommunity/original/2X/8/8197fc10ff2e15280bf22478c1826aaac4917180.png)

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [April 27, 2015, 7:30am UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/2 "2015-04-27T07:30:18Z")

</div>

You know the program’s syntax is correct, because it STOWed. The bug is in the colorization routine, whose logic is not as comprehensive as the compiler.

You can fix the coloring by removing the FOR keyword from the EXAMINE statement, but the EXAMINE won’t read as well.

---

<div class="post-metadata">

**Author:** ![JB\_Newbie](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jb_newbie/32/537_2.png) [@JB\_Newbie](https://techcommunity.softwareag.com/u/JB_Newbie)\
**Post date:** [April 27, 2015, 11:59am UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/3 "2015-04-27T11:59:10Z")

</div>

Good morning. So the syntax is correct, however, there is a bug with the logic. This program gives us intermittent issues, I am assuming this is the spot. It will test ok, yet, something seems to creep up when we put it in to the production environment.

First - in the windows environment, the +/- functionality that allows me to shrink up statements. IF to END-IF, FOR to END-FOR… does not work in the code I posted here. If you try to shrink it up, it collapsed the entire balance of the program. Like it cannot find the end statement.

Also — You said “You can fix the coloring by removing the FOR keyword from the EXAMINE statement, but the EXAMINE won’t read as well.” Is there another way you can suggest to do this to make this work correctly?

Thank you again for your help!! (on both forums)

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [April 27, 2015, 1:22pm UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/4 "2015-04-27T13:22:41Z")

</div>

This does not answer your question; but, if you go into Tools-Options and uncheck expand/collapse, all the boxes go away.

As Ralph said, if it Stows, the code is okay.

Looks like a problem with the expand/collapse feature. I cannot find anywhere which explains why there are two red boxes. Indeed, it does not appear to be any reason for even one red box.

Will play more later

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [April 27, 2015, 1:37pm UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/5 "2015-04-27T13:37:52Z")

</div>

Okay, decided to play a bit more now rather than later

0010 define data local  
0020 1 #loop (n2)  
0030 end-define  
0040 for #loop = 1 to 5  
0050 add 1 to #loop  
0051 if #loop = 4  
0052 add 1 to #loop  
0053 end-for  
0054  
0060 end

The code above produces two two red blocks at lines 0040 and 0051.

The red block for 0051 would appear legitimate since there is no end-if. But why at 0040?  
A bit strange.

Is the code you posted inside of other loops?

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [April 27, 2015, 5:28pm UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/6 "2015-04-27T17:28:06Z")

</div>

> [@JB Newbie](#):
>
> something seems to creep up when we put it in to the production environment

Post a specific question in a new thread.

> [@](#):
>
> If you try to shrink it up, it collapsed the entire balance of the program. Like it cannot find the end statement.

I should have been more specific. The bug is in the “structure” logic which is simplistic and does not differentiate between a FOR statement and a FOR clause. The erroneous coloring of the structure indicator is a result.

> [@](#):
>
> Is there another way you can suggest to do this to make this work correctly?

You can live with it or you can contact SAG Support. This bug has been around for a while, but I consider it a minor one and would not want SAG giving it a high priority.

---

<div class="post-metadata">

**Author:** ![JB\_Newbie](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jb_newbie/32/537_2.png) [@JB\_Newbie](https://techcommunity.softwareag.com/u/JB_Newbie)\
**Post date:** [April 27, 2015, 6:32pm UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/7 "2015-04-27T18:32:41Z")

</div>

ok. Thank you for your help with this.

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [April 27, 2015, 9:51pm UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/8 "2015-04-27T21:51:25Z")

</div>

> [@Steve Robinson](#):
>
> The red block for 0051 would appear legitimate since there is no end-if. But why at 0040?

The structure routine sees the FOR and expects to see END-FOR. Then he sees IF and expects to see END-IF. When END-FOR is found and it doesn’t match the expected END-IF, the IF structure is marked as an error (red). Apparently he continues by looking for the next END-FOR, which is not found, so the FOR is marked as an error, too.

Of course it’s futile to try to debug code that we can’t see. We can only surmise.

What I find interesting is that JB’s issue is caused by the FOR clause of the EXAMINE, but the issue does not occur if the examined string is a scalar. Removing “(\*)” also removes the red coloring from the structure indicator.

```auto
EXAMINE #BUDGET-ARRAY(*) FOR #H-BUDGET(#AA) GIVING INDEX #BB /* red
EXAMINE #BUDGET-ARRAY FOR #H-BUDGET(#AA) GIVING INDEX #BB /* not red
```

Inserting any non-blank character returns it.

```auto
EXAMINE #BUDGET-ARRAY gibberish FOR #H-BUDGET(#AA) GIVING INDEX #BB /* red
```

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [April 28, 2015, 1:55pm UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/9 "2015-04-28T13:55:59Z")

</div>

More “strangeness”

0010 define data local  
0020 1 #a (a3)  
0030 1 #b (a3)  
0040 1 #loop (p3)  
0050 end-define  
0060 repeat  
0070 if #a = #b  
0080 move #a to #b  
0090 else  
0100 if #a = ‘q’  
0110 move #a to #b  
0120 else  
0130 move ‘a’ to #a  
0140 end-if  
0150 for #loop = 1 to 5  
0160 move ‘z’ to #a  
0170 end-for  
0180 move ‘s’ to #b  
0190 end-if  
0200 end-repeat  
0220 end

The program above is “parsed” correctly, with white boxes at 0060, 0070, 0100 and 0150.

I commented out line 0170. So clearly the FOR loop at 0150 has been compromised.

I agree with your idea Ralph, that Natural might get to the END-IF at 0190 and turn not only 0150 red, but also 0070. That seems like a simple “bug” to fix. The END-IF at 0190 should serve a dual role, not only “activate” the red box at 0150, but also should then be “evaluated” as part of the code. This would avoid the “erroneous” red box at line 0070. Probably just a pointer that should have one subtracted from it, to let the END-IF function properly.

However, the problem is more involved than that. There is also a red box at line line 0060, the REPEAT loop.  
Will play with this later, but it looks as if the parser continues to look for an END-FOR, marking all loops until the END as being compromised.

Usually this would be a “Friday topic”, but since we will be traveling to Ohio then, I will try to play before then.

---

<div class="post-metadata">

**Author:** ![JB\_Newbie](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jb_newbie/32/537_2.png) [@JB\_Newbie](https://techcommunity.softwareag.com/u/JB_Newbie)\
**Post date:** [April 28, 2015, 6:22pm UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/10 "2015-04-28T18:22:19Z")

</div>

You guys are great! Thank you for your help with this.

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [April 29, 2015, 7:14am UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/11 "2015-04-29T07:14:51Z")

</div>

> [@Steve Robinson](#):
>
> Will play with this later

I don’t see the point of further effort. The problem has been around since 2009. Probably because it’s easy to live with.  
[http://tech.forums.softwareag.com/techjforum/posts/list/21504.page](http://tech.forums.softwareag.com/techjforum/posts/list/21504.page)

---

<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, 3:33pm UTC](https://techcommunity.softwareag.com/t/mainframe-vs-windows-errors/181666/12 "2021-04-02T15:33:19Z")

</div>


