/* Open flood elevation data file
&s fileunit := [open future.dat openstat -read]
/* Loop through all of the basins.
&do basin = 1 &to 280
     /* Read flood elevation for the basin
     &s basin%basin% = [read %fileunit% readstat]
     &type Basin %basin% has a flood elevation of [value basin%basin%]
     &s ck [exists outgrid1 -GRID]
     &if %ck% &then kill outgrid1

     /* con is a logic operator for grids. Usage is 'con(test,
     /* if test is true, if test is false)' Many of the grid 
     /* operators work on each cell in a grid. In the following 
     /* statement each cell in outgrid is set to either 200 or 
     /* the value of the corresponding cell in fsurfacegrid, 
     /* depending on the results of the logic tests in the con 
     /* statements. If the cell in basin_grid equals the current 
     /* basin, then if the corresponding cell in fsurfacegrid is 
     /* less than the maximum flood stage, set fsurfacegrid to 
     /* 200, otherwise leave the cell in fsurfacegrid alone.
     outgrid1 = con(basin_grid == %basin%, ~
                con(fsurfacegrid < [value basin%basin%], ~
                    200,fsurfacegrid),fsurfacegrid)

     &s ck [exists fsurfacegrid -GRID]
     &if %ck% &then kill fsurfacegrid
     rename outgrid1 fsurfacegrid
&end
/* Close the input data file.
&s closestat := [close -all]