/* ndlg2.aml 11/22/93 Program designed by W Beeman USGS Lakewood, CO.
/* This program was designed to pull data from USGS digital line graph files
/* (DLG) and convert them to ARC/INFO coverages.  It converts the DLG files
/* into polygon coverages, adds a PAT item called plycode and puts the MINOR1
/* attribute into plycode.  It then appends the coverages and reselects out
/* the polygons that are coded as ocean, etc. It was designed for Amy Hessl
/* who is compiling a 1:100000 coastline of the U.S. in an ARC/INFO format.
/* The files that are the basis for the data for her project are hydrography
/* files, and the final five digits for each file name contain the character
/* sequence hyf, for hydrography file, and the two digit sequence of 01 through
/* 08 to reflect the position of each section in the 1/4 quad.  The first two 
/* characters are a code for the quad, and the third digit is a code for the
/* position of the 1/4 quad.  This program is prompted by the first three
/* digits - the unique identifiers for each 1/4 quad - to look for any of
/* the eight sections that might exist in the workspace.  Any existing files
/* are then converted into ARC/INFO coverages, and the coverage built for
/* polys. An item called plycode is added to the attribute table, and the minor1
/* code is put into it from the .pcode info file.  This allows for the eight
/* individual coverages to be appended while still keeping the minor1 code
/* attached to the polys.  The resulting coverage can then have reselect
/* commands executed to pull out any of the coded polys.
/*     This aml is provided as an example of how dlg.aml can be modified to 
/* do specific tasks on different dlg files.  It has been used successfully
/* to perform the functions outlined above, but no warranty is made to its
/* suitability for any other task performed on any other machine.  It was
/* compiled and utilized in ARC version 6.1.1.
/*        wbeeman@greenwood.cr.usgs.gov

&args var1
&echo &on
&severity &error &ignore
&sv var2 := [translate %var1%]
&if [exists %var1%hyf01 -file] &then
&do
dlgarc optional %var1%hyf01 %var1%_01
build %var1%_01 poly
additem %var1%_01.pat %var1%_01.pat plycode 6 6 i
&end
&if [exists %var1%hyf02 -file] &then
&do
dlgarc optional %var1%hyf02 %var1%_02
build %var1%_02 poly
additem %var1%_02.pat %var1%_02.pat plycode 6 6 i
&end
&if [exists %var1%hyf03 -file] &then
&do
dlgarc optional %var1%hyf03 %var1%_03
build %var1%_03 poly
additem %var1%_03.pat %var1%_03.pat plycode 6 6 i
&end
&if [exists %var1%hyf04 -file] &then
&do
dlgarc optional %var1%hyf04 %var1%_04
build %var1%_04 poly
additem %var1%_04.pat %var1%_04.pat plycode 6 6 i
&end
&if [exists %var1%hyf05 -file] &then
&do
dlgarc optional %var1%hyf05 %var1%_05
build %var1%_05 poly
additem %var1%_05.pat %var1%_05.pat plycode 6 6 i
&end
&if [exists %var1%hyf06 -file] &then
&do
dlgarc optional %var1%hyf06 %var1%_06
build %var1%_06 poly
additem %var1%_06.pat %var1%_06.pat plycode 6 6 i
&end
&if [exists %var1%hyf07 -file] &then
&do
dlgarc optional %var1%hyf07 %var1%_07
build %var1%_07 poly
additem %var1%_07.pat %var1%_07.pat plycode 6 6 i
&end
&if [exists %var1%hyf08 -file] &then
&do
dlgarc optional %var1%hyf08 %var1%_08
build %var1%_08 poly
additem %var1%_08.pat %var1%_08.pat plycode 6 6 i
&end
arcedit
&if [exists %var1%_01 -POLYGON] &then
&do
editcover %var1%_01
editfeature label
&if [exists %var1%_01.pcode -INFO] &then
&do
relate add
temp1
%var1%_01.pcode
INFO
%var1%_01-id
%var1%_01-id
ordered
rw
~
select all
calculate plycode = temp1//minor1
relate drop
temp1
~
&end
&end
&if [exists %var1%_02 -POLYGON] &then
&do
editcover %var1%_02
editfeature label
&if [exists %var1%_02.pcode -INFO] &then
&do
relate add
temp1
%var1%_02.pcode
INFO
%var1%_02-id
%var1%_02-id
ordered
rw
~
select all
calculate plycode = temp1//minor1
relate drop
temp1
~
&end
&end
&if [exists %var1%_03 -POLYGON] &then
&do
editcover %var1%_03
editfeature label
&if [exists %var1%_03.pcode -INFO] &then
&do
relate add
temp1
%var1%_03.pcode
INFO
%var1%_03-id
%var1%_03-id
ordered
rw
~
select all
calculate plycode = temp1//minor1
relate drop
temp1
~
&end
&end
&if [exists %var1%_04 -POLYGON] &then
&do
editcover %var1%_04
editfeature label
&if [exists %var1%_04.pcode -INFO] &then
&do
relate add
temp1
%var1%_04.pcode
INFO
%var1%_04-id
%var1%_04-id
ordered
rw
~
select all
calculate plycode = temp1//minor1
relate drop
temp1
~
&end
&end
&if [exists %var1%_05 -POLYGON] &then
&do
editcover %var1%_05
editfeature label
&if [exists %var1%_05.pcode -INFO] &then
&do
relate add
temp1
%var1%_05.pcode
INFO
%var1%_05-id
%var1%_05-id
ordered
rw
~
select all
calculate plycode = temp1//minor1
relate drop
temp1
~
&end
&end
&if [exists %var1%_06 -POLYGON] &then
&do
editcover %var1%_06
editfeature label
&if [exists %var1%_06.pcode -INFO] &then
&do
relate add
temp1
%var1%_06.pcode
INFO
%var1%_06-id
%var1%_06-id
ordered
rw
~
select all
calculate plycode = temp1//minor1
relate drop
temp1
~
&end
&end
&if [exists %var1%_07 -POLYGON] &then
&do
editcover %var1%_07
editfeature label
&if [exists %var1%_07.pcode -INFO] &then
&do
relate add
temp1
%var1%_07.pcode
INFO
%var1%_07-id
%var1%_07-id
ordered
rw
~
select all
calculate plycode = temp1//minor1
relate drop
temp1
~
&end
&end
&if [exists %var1%_08 -POLYGON] &then
&do
editcover %var1%_08
editfeature label
&if [exists %var1%_08.pcode -INFO] &then
&do
relate add
temp1
%var1%_08.pcode
INFO
%var1%_08-id
%var1%_08-id
ordered
rw
~
select all
calculate plycode = temp1//minor1
relate drop
temp1
~
&end
&end
q
y
y
&data ARC INFO
ARC
&if [exists %var2%_01.ACODE -INFO] &then
&do
SELECT %var2%_01.ACODE
ERASE %var2%_01.ACODE
Y
&end
&if [exists %var2%_02.ACODE -INFO] &then
&do
SELECT %var2%_02.ACODE
ERASE %var2%_02.ACODE
Y
&end
&if [exists %var2%_03.ACODE -INFO] &then
&do
SELECT %var2%_03.ACODE
ERASE %var2%_03.ACODE
Y
&end
&if [exists %var2%_04.ACODE -INFO] &then
&do
SELECT %var2%_04.ACODE
ERASE %var2%_04.ACODE
Y
&end
&if [exists %var2%_05.ACODE -INFO] &then
&do
SELECT %var2%_05.ACODE
ERASE %var2%_05.ACODE
Y
&end
&if [exists %var2%_06.ACODE -INFO] &then
&do
SELECT %var2%_06.ACODE
ERASE %var2%_06.ACODE
Y
&end
&if [exists %var2%_07.ACODE -INFO] &then
&do
SELECT %var2%_07.ACODE
ERASE %var2%_07.ACODE
Y
&end
&if [exists %var2%_08.ACODE -INFO] &then
&do
SELECT %var2%_08.ACODE
ERASE %var2%_08.ACODE
Y
&end
&if [exists %var2%_01.PCODE -INFO] &then
&do
SELECT %var2%_01.PCODE
ERASE %var2%_01.PCODE
Y
&end
&if [exists %var2%_02.PCODE -INFO] &then
&do
SELECT %var2%_02.PCODE
ERASE %var2%_02.PCODE
Y
&end
&if [exists %var2%_03.PCODE -INFO] &then
&do
SELECT %var2%_03.PCODE
ERASE %var2%_03.PCODE
Y
&end
&if [exists %var2%_04.PCODE -INFO] &then
&do
SELECT %var2%_04.PCODE
ERASE %var2%_04.PCODE
Y
&end
&if [exists %var2%_05.PCODE -INFO] &then
&do
SELECT %var2%_05.PCODE
ERASE %var2%_05.PCODE
Y
&end
&if [exists %var2%_06.PCODE -INFO] &then
&do
SELECT %var2%_06.PCODE
ERASE %var2%_06.PCODE
Y
&end
&if [exists %var2%_07.PCODE -INFO] &then
&do
SELECT %var2%_07.PCODE
ERASE %var2%_07.PCODE
Y
&end
&if [exists %var2%_08.PCODE -INFO] &then
&do
SELECT %var2%_08.PCODE
ERASE %var2%_08.PCODE
Y
&end
Q STOP
&end
append %var1%_all poly all
%var1%_01
%var1%_02
%var1%_03
%var1%_04
%var1%_05
%var1%_06
%var1%_07
%var1%_08
end
clean %var1%_all
reselect %var1%_all %var1%_sea poly
reselect plycode = 116
~
n
n
kill %var1%_01 all
kill %var1%_02 all
kill %var1%_03 all
kill %var1%_04 all
kill %var1%_05 all
kill %var1%_06 all
kill %var1%_07 all
kill %var1%_08 all
&echo &off 
&return