Incorrect error message, odd array error.

William James McEachran billmc at dataffinity.com
Wed Jun 2 12:09:09 PDT 2004


I'm getting a bogus filePro error claiming array index out of range with the
following code.

  5  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
         If:                                                                   
       Then: dim prfttl[7](8,.2):273   'array against real fields                                        
  6  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
        If:                                                                   
       Then: dim prffac[7](12,.8)      'hold array in memory

Then later on ...

 15  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
         If:                                                                   
       Then: np=asc(LIA_DO)-"67"   'sets place in pref arrays                  
 16  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
         If:                                                                   
       Then: msgbox "\nnp is" < np { "\nprfttl[np] is" < prfttl[np]            
 17  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
         If:                                                                   
       Then: at=at-prfttl[np]  'refuses to work, claims np is "0"   

The message box produces:


                           +-----------------------+
                           |                       |
                           | np is 3               |
                           | prfttl[np] is 5000.00 |
                           +------- Press  Enter   +

So, all appears well ... however ... the next thing to happen is bad.

-----------------------------------------------
*** A filePro Error Has Occurred ***

Array Index Out of Range: dim prfttl(7) -- Index: 0

Output Processing
Line Number: 17

at=at-prfttl[np]  'refuses to work, claims np is "0"

Process contains a syntax error at position indicated.
-------------------------------------------------
 

Isn't that wierd?

BTW, variable "at" is defined as "at(15,.6)"
The real fields 273-279 are (8,.2) used in the array 'prfttl'

Interestingly enough, changing from using a dummy field to a declared variable
works.

15  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
         If:                                                                   
       Then: np=asc(LIA_DO)-"67"   'sets place in pref arrays                  
 16  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
         If:                                                                   
       Then: msgbox "\nnp is" < np { "\nprfttl[np] is" < prfttl[np]            
 17  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
         If:                                                                   
       Then: declare local HOLD(8.2); HOLD=prfttl[np]   
 18  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
         If:                                                                   
       Then: at=at-HOLD         
19  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
         If:                                                                   
       Then: msgbox "HOLD is" < HOLD { "\nat is" < at    

Running it again and the new message box displays the expected values.

                              +------------------+
                              | HOLD is 5000.00  |
                              | at is .00        | 
                              +-- Press  Enter   +

Any idea why filePro is reporting the bogus error message?
TIA,
-- 
Bill McEachran


More information about the Filepro-list mailing list