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.
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.
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.
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 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?
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?
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).