Consider the function following EASI script defined in the file TEST.EAS: (The line numbers are for reference only and are not part of the actual code).
1 local int file_spec, num_pixels
2
3 file_spec = DBOpen( "$PCIHOME/demo/irvine.pix", "r" )
4 num_pixels = DBPixels( file_spec )
5
6 local int dataline[num_pixels]
7 call DBReadLine( file_spec, 1, 0, 0, num_pixels, dataline )
8 call DBClose( file_spec )
9
10 local int i, min_val, max_val
11 min_val = 257
12 max_val = -1
13
14 for i = 0 to num_pixels-1
15 if ( dataline[i] < min_val ) min_val = dataline[i]
16 if ( dataline[i] > max_val ) max_val = dataline[i]
17 endfor
18
19 printf "The minimum value is %d\n", min_val
20 printf "The maximum value is %d\n", max_val
The script is intended to load the first line of data from the first channel of the file irvine.pix and then compute the minimum and maximum data values in the file. When run, however, the following error occurs:
TEST.EAS:15:E600:Expression type mismatch (<).
if ( dataline[i] < min_val ) min_val = dataline[i]
It may not be immediately obvious why this happens. To find out more, we'll use the DEBUG support in EASI. After entering EASI, the script is first loaded.
EASI>load "TEST.EAS"
next a breakpoint is set at the offending line.
EASI>debug break test 15
The script can now be run. It stops at the breakpoint:
EASI>run test
Halted at breakpoint 1 (function TEST, file TEST.EAS, line 15)
Halted at function TEST, file TEST.EAS, line 15:
if ( dataline[i] < min_val ) min_val = dataline[i]
EASI DEBUG 1>
The special DEBUG prompt is printed, indicating that execution is halted during the execution of a script. The digit '1' here indicates the number of nested DEBUG sessions. The current values of variables can be examined.
EASI DEBUG 1>print i 0 EASI DEBUG 1>print min_val 257 EASI DEBUG 1>print dataline[i] {array of 512 INTEGER(s) at 0x8347b48}
The value of dataline[i] <= dataline[0]) is unexpected. In fact, arrays in EASI are indexed starting at the value 1 instead of 0 as in C. This is the source of the bug. Execution of the program is halted:
EASI DEBUG 1>debug quit
EASI>
The code can now be modified, changing line 14 to:
for i = 1 to num_pixels
After rerunning the program, it now results in the following output:
EASI>run test The minimum value is 50 The maximum value is 81
This is the correct result that was desired.
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.