Suppose you want to create an associative array that associates country codes with the name of the country. You could use a table for the lookup, but because the lookups don’t change, reading the table into an array once at the beginning of the application makes the application run faster.

use COUNTRY order CODE

aCountry = new AssocArray

scan

aCountry[ CODE ] = NAME 

endscan

If you had to create the array manually, the code would look like this:

aCountry = new AssocArray()

aCountry[ "AFG" ] = "Afghanistan"

aCountry[ "ALB" ] = "Albania"

aCountry[ "ALG" ] = "Algeria"

aCountry[ "ASA" ] = "American Samoa"

// ...

aCountry[ "ZAM" ] = "Zambia"

aCountry[ "ZIM" ] = "Zimbabwe"