English

How To: APPEND and MAPJOIN coverages listed in a text file

Summary

AML looping syntax to enable the APPEND and MAPJOIN commands to read coverage names from a text file.

Procedure

  1. Create a text file with the names of the coverages to be used by APPEND or MAPJOIN in a list format. The [LISTFILE] function may be helpful in this situation, as it has the option to write the list to an output ascii file.

    Code:
    Arc: &type [listfile * -cover covlist.txt]

    This example will write the names of all coverages in the current workspace to the file COVLIST.TXT.
  2. The following code is an example of how to read the coverage names from the text file and supply them to the dialog of the APPEND or MAPJOIN command in a loop.

    Code:
    &SETVAR fileunit = [OPEN covlist.txt openstat -READ]

    &SETVAR covname = [READ %fileunit% readstat]

    /* Insert the syntax for either MAPJOIN or APPEND here.
    /* For example:

    APPEND outcov polygon

    &DO &UNTIL %readstat% = 102
    [VALUE covname]
    &SETVAR covname = [READ %fileunit% readstat]
    &END
    [UNQUOTE ' ']
    y
    y

    &SETVAR close_stat = [CLOSE -ALL]

    &RETURN