English

How To: Automatically increment through a neighborhood in a DOCELL block

Summary

This document demonstrates how to programatically increment an AML variable in a DOCELL block.

Procedure

Scalar variables cannot be used in neighborhood notation, so you must use AML variables to increment through a neighborhood.

Code:
&sv range = 16

DOCELL
&do i = -%range% &to %range%
&do j = -%range% &to %range%

if (%grid1%(%i%,%j%)== 10)
for_sum = scalar(for_sum + 1)
else if (%grid1%(%i%,%j%) == 20)
res_sum = scalar(res_sum + 1)
else if (%grid1%(%i%,%j%) == 25)
agr_sum = scalar(agr_sum + 1)
else if (%grid1%(%i%,%j%) == 40)
ind_sum = scalar(ind_sum + 1)
endif

&end /* &do j
&end /* &do i
END /* DOCELL


Note:
AML code within DOCELL is evaluated and expanded before the DOCELL block is executed in GRID.