Array Subscript Error

jpachut

New Member
Can anyone help me with this error message.

I have no idea what they are talking about...

Here is my error message
[FONT=r_ansi][/FONT]
[FONT=r_ansi][FONT=r_symbol][/FONT][FONT=r_ansi]** Array subscript is less than 1 or greater than extent. (367) [/FONT][FONT=r_symbol]
[/FONT][FONT=r_ansi]** Could not understand line 100. (196) [/FONT][FONT=r_symbol]
[/FONT][FONT=r_ansi]** Array subscript is less than 1 or greater than extent. (367) [/FONT][FONT=r_symbol]
[/FONT][FONT=r_ansi]** Could not understand line 140. (196) [/FONT][FONT=r_symbol]
[/FONT][FONT=r_ansi]** Array subscript is less than 1 or greater than extent. (367)[/FONT][FONT=r_symbol]
[/FONT][FONT=r_ansi]** Could not understand line 173. (196)
[/FONT]
[/FONT][FONT=r_ansi][/FONT]
[FONT=r_ansi][/FONT]
[FONT=r_ansi]Here is my define var...[/FONT]
[FONT=r_ansi][FONT=r_ansi]DEFINE variable w-site like ff_site initial "PROD".
DEFINE VARIABLE ws-from-cell LIKE ro_wkctr no-undo.
DEFINE VARIABLE ws-thru-cell LIKE ro_wkctr no-undo.
DEFINE variable fcyear like ff_year initial "2007".
DEFINE variable ws-slct-qty as integer extent 18.
DEFINE variable w-ctrnbr as integer.
DEFINE variable w-wkctr like ro_wkctr.
DEFINE variable fcstid like ff_id init "BUDGET07".
DEFINE variable fcstid1 like ff_id.
DEFINE variable ff-time as integer extent 18.
DEFINE variable h as integer.
DEFINE variable ff_adj_fc as decimal extent 8 FORMAT "->>>>>>9".

here is the lines where the error is showing.

line 100
[FONT=r_ansi]if substring(ro_wkctr,5,1) <> "0" and (w-ctrnbr > 0 and w-ctrnbr < 8 )
or w-ctrnbr = 9 then

line 140
[FONT=r_ansi]form
ff_part at 1
pt_desc1 format "x(24)"
ff_adj_fc [1] column-label " January " format "->>>>>>>9 "
ff_adj_fc [2] column-label " February " format "->>>>>>>9 "
[/FONT]
[/FONT]
[/FONT]
[/FONT][FONT=r_ansi][/FONT]
[FONT=r_ansi][/FONT]
[FONT=r_ansi]Line 173[/FONT]
[FONT=r_ansi][FONT=r_ansi]display ff_part pt_desc1
ff_adj_fc [1] (sub-total by ro_wkctr)
ff_adj_fc [1] (total by ro_wkctr)
ff_adj_fc [2] (sub-total by ro_wkctr)
ff_adj_fc [2] (total by ro_wkctr)

what am i doing wrong...

[/FONT]
[/FONT]
 
jpachut,

there are either more than 18 times that [FONT=r_ansi][FONT=r_ansi]ff-time [/FONT][/FONT]gets filled (more than 18 times when '[FONT=r_ansi][FONT=r_ansi][FONT=r_ansi]if substring(ro_wkctr,5,1) <> "0" and (w-ctrnbr > 0 and w-ctrnbr < 8 )
or w-ctrnbr = 9 then'
[/FONT]
[/FONT]
[/FONT]is true) or less than 1 time.
check the incrementation ff-time[x] and just put the if logic in another procedure and use an integer to count how many times it hits on true.
regards,
longhair
 
check the incrementation ff-time[x] and just put the if logic in another procedure and use an integer to count how many times it hits on true.

It's a compile time error (I think), so the incrementation hasn't happened yet.


[FONT=r_ansi][FONT=r_ansi]** Array subscript is less than 1 or greater than extent. (367) [/FONT]
[FONT=r_ansi]** Could not understand line 100. (196) [/FONT]
[FONT=r_ansi]** Array subscript is less than 1 or greater than extent. (367) [/FONT]
[FONT=r_ansi]** Could not understand line 140. (196) [/FONT]
[FONT=r_ansi]** Array subscript is less than 1 or greater than extent. (367)[/FONT]
[FONT=r_ansi]** Could not understand line 173. (196) [/FONT]

:
:

[/FONT]

[FONT=r_ansi][FONT=r_ansi]DEFINE variable ff_adj_fc as decimal extent 8 FORMAT "->>>>>>9".[/FONT]

[FONT=r_ansi]here is the lines where the error is showing.[/FONT]
[/FONT][FONT=r_ansi]
[/FONT]

The lines you have highlighted are just the first lines of the statements where the error is occurring - see if you have any references to your array variables where the subscript is outside the bounds of the extent within the rest of the statement.

eg. you have defined the array ff_adj_fc to have 8 elements, so make sure you are making no reference to (eg). ff_adj_fc[0] or ff_adj_fc[9], in say, your form statement.
 
It's definitely a compile-time problem. My guess is something's wrong with 'ro_wkctr' definition. It's absent in your snippet could you post it?

BTW I tried to reproduce your situation and found out that arrays behavior differs between progress versions, e.g. the following code is correct for 10.1 and absolutely incorrect for 9.1

Code:
DEFINE VARIABLE r AS CHARACTER  NO-UNDO EXTENT.
r > "".
 
Back
Top