# Error 1006

**URL:** <https://techcommunity.softwareag.com/t/error-1006/75534>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [October 18, 2007, 3:09pm UTC](https://techcommunity.softwareag.com/t/error-1006/75534 "2007-10-18T15:09:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![subba](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@subba](https://techcommunity.softwareag.com/u/subba)\
**Post date:** [October 18, 2007, 3:09pm UTC](https://techcommunity.softwareag.com/t/error-1006/75534/1 "2007-10-18T15:09:27Z")

</div>

Hi

I am getting error 1006 with the following description “Value specified for index is ‘0’ or greater than maximum”. I am trying to dot the following code while debugging I am getting this error.

Code:

FIND FIRST view WITH field-name = filed.

Can you please let me what is cause for this error.

Thanks in advance.

---

<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:** [October 18, 2007, 3:49pm UTC](https://techcommunity.softwareag.com/t/error-1006/75534/2 "2007-10-18T15:49:35Z")

</div>

Hi Subba;

Let me guess, the field-name (search field) is something like a multiple valued field within a periodic group; or the “filed” (value being searched for) is an array. In either case, subscripts would be required.

steve

---

<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:** [October 18, 2007, 3:54pm UTC](https://techcommunity.softwareag.com/t/error-1006/75534/3 "2007-10-18T15:54:38Z")

</div>

Actually, if the right hand side of the equals sign is an array, you get

NAT0281 Index entry missing or invalid for an array.

not a NAT1006.

Is the field name being searched for other than a simple descriptor ?

steve

---

<div class="post-metadata">

**Author:** ![subba](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@subba](https://techcommunity.softwareag.com/u/subba)\
**Post date:** [October 18, 2007, 4:54pm UTC](https://techcommunity.softwareag.com/t/error-1006/75534/4 "2007-10-18T16:54:52Z")

</div>

Here

Thanks for your help.  
Regards  
Subba

Here

find first view-name with search-field = #rate-plankey  
if \*number = 0  
do  
move…  
doned  
else  
do  
obtain code-1(0140/1:2)  
code-2(0140/1:2,1:191)  
code-3(0140/1:2,1:191)

for #i = 1 thru 2  
for #i2 = 1 thru 174  
move code-2(0140/#i,#i2)  
to field  
move code-3(0140/#i,#i2)  
to field  
close loop  
close loop

this is the only code in my program. so when i am debugging this code i am getting an error find statement itself. Please help me in regard.

Thanks for your cooperation.  
Regards

Subba

---

<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:** [October 18, 2007, 5:31pm UTC](https://techcommunity.softwareag.com/t/error-1006/75534/5 "2007-10-18T17:31:39Z")

</div>

Is the new descriptor field within a periodic group; or an MU within a periodic group? Is it null suppressed? what are the formats of the new descriptor and #RATE-PLAN-KEY?

could you post the View ADA056?

steve

---

<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:** [October 19, 2007, 4:09pm UTC](https://techcommunity.softwareag.com/t/error-1006/75534/6 "2007-10-19T16:09:00Z")

</div>

Could you post the code that is just before and just after the FIND FIRST ( a couple of statements on either side).

Also, even if you asterisk out non relevant fields, could you post the View ADA056.

I have never seen a NAT1006 except when dealing with an MU/PE . I have tried to force such an error with a user defined array, but always get different error messages (e.g. a 281).

Are there MU/PEs anywhere near where you received the error message?

steve

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [October 22, 2007, 8:18am UTC](https://techcommunity.softwareag.com/t/error-1006/75534/7 "2007-10-22T08:18:47Z")

</div>

a suggestion: try changing the MOVE code:

```auto
for #i = 1 thru 2
  for #i2 = 1 thru 174
    move code-2(0140/1.#i,1.#i2) to field
    move code-3(0140/1.#i,1.#i2) to field
  close loop
close loop 
```

---

<div class="post-metadata">

**Author:** ![subba](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@subba](https://techcommunity.softwareag.com/u/subba)\
**Post date:** [October 22, 2007, 10:40am UTC](https://techcommunity.softwareag.com/t/error-1006/75534/8 "2007-10-22T10:40:15Z")

</div>

Hi Kelly,

Thanks for your suggestion it worked fine for me. I think there is a major difference between Reporting mode vs Structure mode. I think we should give 1.#i or something like when we are using Reporting mode is it right?

Thanks a lot.

Subba

---

<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:** [October 22, 2007, 4:09pm UTC](https://techcommunity.softwareag.com/t/error-1006/75534/9 "2007-10-22T16:09:59Z")

</div>

Yes, Subba, there are many differences between Structured Mode and Report Mode.

Some comments about your code. Take a look at the following program:

READ (1) EMPLOYEES  
REDEFINE LANG (1-3) (#STRING (A9))  
REDEFINE LANG (1-3) (#A (A3/1:3))  
WRITE LANG (_) / #STRING / #A (_)  
LOOP  
END

LANG is an MU field. Note it can be REDEFINE’d as another array, or a string. This would perhaps eliminate your double nested FOR loop, which is VERY inefficient for what you are trying to do.

Also note that there is no OBTAIN statement in my code. If you use MU or PE occurrences explicitly in a loop (as in the REDEFINEs) you do not have to use OBTAIN.

Also, OBTAIN is NOT an executable statement, it is a “message” to the compiler. The placing of your OBTAIN, in the ELSE clause, would seem to indicate you think this only applies to the ELSE condition (which in some sense it does, since otherwise there are no records found).

steve

---

<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:48pm UTC](https://techcommunity.softwareag.com/t/error-1006/75534/10 "2021-04-02T14:48:50Z")

</div>


