#!/usr/bin/python # # mkdd -- used to generate code for btiger.py, and that's all # # Copyright (c) 2007 Brian "Beej Jorgensen" Hall # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # import sys dd = ( ( ("1", "Complete Chain Basic Data Record"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number", "SIDE1 Yes R N 16 16 1 Single-Side Complete Chain Code", "SOURCE Yes L A 17 17 1 Linear Segment Source Code", "FEDIRP Yes L A 18 19 2 Feature Direction, Prefix", "FENAME Yes L A 20 49 30 Feature Name", "FETYPE Yes L A 50 53 4 Feature Type", "FEDIRS Yes L A 54 55 2 Feature Direction, Suffix", "CFCC Yes L A 56 58 3 Census Feature Class Code", "FRADDL Yes R A 59 69 11 Start Address, Left", "TOADDL Yes R A 70 80 11 End Address, Left", "FRADDR Yes R A 81 91 11 Start Address, Right", "TOADDR Yes R A 92 102 11 End Address, Right", "FRIADDL Yes L A 103 103 1 Start Imputed Address Flag, Left", "TOIADDL Yes L A 104 104 1 End Imputed Address Flag, Left", "FRIADDR Yes L A 105 105 1 Start Imputed Address Flag, Right", "TOIADDR Yes L A 106 106 1 End Imputed Address Flag, Right", "ZIPL Yes L N 107 111 5 ZIP Code, Left", "ZIPR Yes L N 112 116 5 ZIP Code, Right", "AIANHHL Yes L N 117 121 5 FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 Left", "AIANHHR Yes L N 122 126 5 FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 Right", "AIHHTLIL Yes L A 127 127 1 American Indian/Hawaiian Home Land Trust Land Indicator, 2000 Left", "AIHHTLIR Yes L A 128 128 1 American Indian/Hawaiian Home Land Trust Land Indicator, 2000 Right", "CENSUS1 Yes L A 129 129 1 Census Use 1", "CENSUS2 Yes L A 130 130 1 Census Use 2", "STATEL Yes L N 131 132 2 FIPS State Code, 2000 Left", "STATER Yes L N 133 134 2 FIPS State Code, 2000 Right", "COUNTYL Yes L N 135 137 3 FIPS County Code, 2000 Left", "COUNTYR Yes L N 138 140 3 FIPS County Code, 2000 Right", "COUSUBL Yes L N 141 145 5 FIPS 55 Code (County Subdivision), 2000 Left", "COUSUBR Yes L N 146 150 5 FIPS 55 Code (County Subdivision), 2000 Right", "SUBMCDL Yes L N 151 155 5 FIPS 55 Code (Subbarrio), 2000 Left", "SUBMCDR Yes L N 156 160 5 FIPS 55 Code (Subbarrio), 2000 Right", "PLACEL Yes L N 161 165 5 FIPS 55 Code (Place/CDP), 2000 Left", "PLACER Yes L N 166 170 5 FIPS 55 Code (Place/CDP), 2000 Right", "TRACTL Yes L N 171 176 6 Census Tract Code, 2000 Left", "TRACTR Yes L N 177 182 6 Census Tract Code, 2000 Right", "BLOCKL Yes L N 183 186 4 Census Block Number, 2000 Left", "BLOCKR Yes L N 187 190 4 Census Block Number, 2000 Right", "FRLONG No R N 191 200 10 Start Longitude", "FRLAT No R N 201 209 9 Start Latitude", "TOLONG No R N 210 219 10 End Longitude", "TOLAT No R N 220 228 9 End Latitude",) ), ( ("2", "Complete Chain Shape Coordinates"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number", "RTSQ No R N 16 18 3 Record Sequence Number", "LONG1 No R N 19 28 10 Point 1, Longitude", "LAT1 No R N 29 37 9 Point 1, Latitude", "LONG2 Yes R N 38 47 10 Point 2, Longitude", "LAT2 Yes R N 48 56 9 Point 2, Latitude", "LONG3 Yes R N 57 66 10 Point 3, Longitude", "LAT3 Yes R N 67 75 9 Point 3, Latitude", "LONG4 Yes R N 76 85 10 Point 4, Longitude", "LAT4 Yes R N 86 94 9 Point 4, Latitude", "LONG5 Yes R N 95 104 10 Point 5, Longitude", "LAT5 Yes R N 105 113 9 Point 5, Latitude", "LONG6 Yes R N 114 123 10 Point 6, Longitude", "LAT6 Yes R N 124 132 9 Point 6, Latitude", "LONG7 Yes R N 133 142 10 Point 7, Longitude", "LAT7 Yes R N 143 151 9 Point 7, Latitude", "LONG8 Yes R N 152 161 10 Point 8, Longitude", "LAT8 Yes R N 162 170 9 Point 8, Latitude", "LONG9 Yes R N 171 180 10 Point 9, Longitude", "LAT9 Yes R N 181 189 9 Point 9, Latitude", "LONG10 Yes R N 190 199 10 Point 10, Longitude", "LAT10 Yes R N 200 208 9 Point 10, Latitude",) ), ( ("3", "Complete Chain Geographic Entity Codes"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number", "STATE90L Yes L N 16 17 2 FIPS State Code, 1990 Left", "STATE90R Yes L N 18 19 2 FIPS State Code, 1990 Right", "COUNTY90L Yes L N 20 22 3 FIPS County Code, 1990 Left", "COUNTY90R Yes L N 23 25 3 FIPS County Code, 1990 Right", "COUSUB90L Yes L N 26 30 5 FIPS 55 Code (County Subdivision), 1990 Left", "COUSUB90R Yes L N 31 35 5 FIPS 55 Code (County Subdivision), 1990 Right", "PLACE90L Yes L N 36 40 5 FIPS 55 Code (Place/CDP), 1990 Left", "PLACE90R Yes L N 41 45 5 FIPS 55 Code (Place/CDP), 1990 Right", "TRACT90L Yes L N 46 51 6 Census Tract/BNA Code, 1990 Left", "TRACT90R Yes L N 52 57 6 Census Tract/BNA Code, 1990 Right", "AIANHHCE90L Yes L N 58 61 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land*), 1990 Left", "AIANHHCE90R Yes L N 62 65 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land*), 1990 Right", "AIHHTLI90L Yes L A 66 66 1 American Indian/Hawaiian Home Land* Trust Land Indicator, 1990 Left", "AIHHTLI90R Yes L A 67 67 1 American Indian /Hawaiian Home Land* Trust Land Indicator, 1990 Right", "RS1 Yes L A 68 69 2 Reserved Space 1", "BLOCK90L Yes L A 70 73 4 Census Block Number, 1990 Left", "BLOCK90R Yes L A 74 77 4 Census Block Number, 1990 Right", "AIANHHCEL Yes L N 78 81 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 Left", "AIANHHCER Yes L N 82 85 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land*), 2000 Right", "ANRCL Yes L N 86 90 5 FIPS 55 Code (ANRC), 2000 Left", "ANRCR Yes L N 91 95 5 FIPS 55 Code (ANRC), 2000 Right", "AITSCEL Yes L N 96 98 3 Census Code (American Indian Tribal Subdivision), 2000 Left", "AITSCER Yes L N 99 101 3 Census Code (American Indian Tribal Subdivision), 2000 Right", "AITSL Yes L N 102 106 5 FIPS 55 Code (American Indian Tribal Subdivision), 2000 Left", "AITSR Yes L N 107 111 5 FIPS 55 Code (American Indian Tribal Subdivision), 2000 Right",) ), ( ("4", "Index to Alternate Feature Identifiers"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number", "RTSQ No R N 16 18 3 Record Sequence Number", "FEAT1 No R N 19 26 8 Line Additional Name Identification Number, First", "FEAT2 Yes R N 27 34 8 Line Additional Name Identification Number, Second", "FEAT3 Yes R N 35 42 8 Line Additional Name Identification Number, Third", "FEAT4 Yes R N 43 50 8 Line Additional Name Identification Number, Fourth", "FEAT5 Yes R N 51 58 8 Line Additional Name Identification Number, Fifth",) ), ( ("5", "Complete Chain Feature Identifiers"), ("RT No L A 1 1 1 Record Type", "FILE No L N 2 6 5 File Code", "FEAT No R N 7 14 8 Line Name Identification Number", "FEDIRP Yes L A 15 16 2 Feature Direction, Prefix", "FENAME Yes L A 17 46 30 Feature Name", "FETYPE Yes L A 47 50 4 Feature Type", "FEDIRS Yes L A 51 52 2 Feature Direction, Suffix",) ), ( ("6", "Additional Address Range and ZIP Code Data"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number", "RTSQ No R N 16 18 3 Record Sequence Number", "FRADDL Yes R A 19 29 11 Start Address, Left", "TOADDL Yes R A 30 40 11 End Address, Left", "FRADDR Yes R A 41 51 11 Start Address, Right", "TOADDR Yes R A 52 62 11 End Address, Right", "FRIADDL Yes L A 63 63 1 Start Imputed Address Flag, Left", "TOIADDL Yes L A 64 64 1 End Imputed Address Flag, Left", "FRIADDR Yes L A 65 65 1 Start Imputed Address Flag, Right", "TOIADDR Yes L A 66 66 1 End Imputed Address Flag, Right", "ZIPL Yes L N 67 71 5 ZIP Code, Left", "ZIPR Yes L N 72 76 5 ZIP Code, Right",) ), ( ("7", "Landmark Features"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "FILE No L N 6 10 5 File Code", "LAND No R N 11 20 10 Landmark Identification Number", "SOURCE Yes L A 21 21 1 Source or First Source Code to Update", "CFCC Yes L A 22 24 3 Census Feature Class Code", "LANAME Yes L A 25 54 30 Landmark Name", "LALONG Yes R N 55 64 10 Longitude", "LALAT Yes R N 65 73 9 Latitude", "FILLER Yes L A 74 74 1 Filler (to make even character count)",) ), ( ("8", "Polygons Linked to Area Landmarks"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "FILE No L N 6 10 5 File Code", "CENID No L A 11 15 5 Census File Identification Code", "POLYID No R N 16 25 10 Polygon Identification Code", "LAND No R N 26 35 10 Landmark Identification Number", "FILLER Yes L A 36 36 1 Filler (to make even character count)",) ), ( ("9", "Key Geographic Location Features"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "FILE No L N 6 10 5 File Code", "CENID No L A 11 15 5 Census File Identification Code", "POLYID No R N 16 25 10 Polygon Identification Code", "SOURCE Yes L A 26 26 1 Source or First Source Code to Update", "CFCC Yes L A 27 29 3 Census Feature Class Code", "KGLNAME Yes L A 30 59 30 Key Geographic Location Name", "KGLADD Yes R A 60 70 11 Key Geographic Location Address", "KGLZIP Yes L N 71 75 5 Key Geographic Location ZIP Code", "KGLZIP4 Yes L N 76 79 4 +4 Postal Add-On Code for KGL", "FEAT Yes R N 80 87 8 Line Name Identification Number", "FILLER Yes L A 88 88 1 Filler (to make even character count)",) ), ( ("A", "Polygon Geographic Entity Codes"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "FILE No L N 6 10 5 File Code", "CENID No L A 11 15 5 Census File Identification Code", "POLYID No R N 16 25 10 Polygon Identification Code", "AIANHH90 Yes L N 26 30 5 FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land*), 1990", "COUSUB90 Yes L N 31 35 5 FIPS 55 Code (County Subdivision), 1990", "PLACE90 Yes L N 36 40 5 FIPS 55 Code (Place/CDP), 1990", "TRACT90 Yes L N 41 46 6 Census Tract/BNA Code, 1990", "BLOCK90 Yes L A 47 50 4 Census Block Number, 1990", "CD106 Yes R N 51 52 2 Congressional District Code, 106th", "CD108 Yes R N 53 54 2 Congressional District Code, 108th (not filled)", "SDELM Yes L A 55 59 5 School District Code, Elementary School", "PUMA1 Yes L N 60 64 5 Public Use Microdata Area File, 1990", "SDSEC Yes L A 65 69 5 School District Code, Secondary School", "SDUNI Yes L A 70 74 5 School District Code, Unified District", "TAZ Yes R A 75 80 6 Traffic Analysis Zone Code, 2000", "UA90 Yes L N 81 84 4 Census Urbanized Area Code, 1990", "UR90 Yes L A 85 85 1 Urban/Rural Indicator, 1990", "RS5 Yes L A 86 89 4 Reserved Space 5", "STATE90 Yes L N 90 91 2 FIPS State Code, 1990", "COUNTY90 Yes L N 92 94 3 FIPS County Code, 1990", "AIANHHCE90 Yes L N 95 98 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land*), 1990",) ), ( ("C", "Geographic Entity Names"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "STATE Yes L N 6 7 2 FIPS State Code", "COUNTY Yes L N 8 10 3 FIPS County Code", "DATAYR Yes L N 11 14 4 FIPS Code, Name, and/or Attribute Data Applicable Year", "FIPS Yes L N 15 19 5 FIPS PUB 55-3 Code", "FIPSCC Yes L A 20 21 2 FIPS 55 Class Code", "PLACEDC Yes L A 22 22 1 Place Description Code", "LSADC Yes L A 23 24 2 Legal/Statistical Area Description Code", "ENTITY No L A 25 25 1 Entity Type Code", "MA Yes L N 26 29 4 Metropolitan Area Code", "SD Yes L N 30 34 5 School District Code", "AIANHHCE Yes L N 35 38 4 Census American Indian/Alaska Native Area/Hawaiian Home Land Code", "VTDTRACT Yes R A 39 44 6 Census Voting District Code/Census Tract Code", "UAUGA Yes L N 45 49 5 Census Urban Area Code*/Urban Growth Area Code", "AITSCE Yes L N 50 52 3 Census American Indian Tribal Subdivision Code", "NAME No L A 53 112 60 Name of Geographic Area",) ), ( ("H", "TIGER/Line ID History"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "FILE No L N 6 10 5 File Code", "TLID No R N 11 20 10 TIGER/Line ID, Permanent Record Number", "HIST Yes L A 21 21 1 History or Last Source Code to Update", "SOURCE No L A 22 22 1 Source or First Source Code to Update", "TLIDFR1 Yes R N 23 32 10 TIGER/Line ID, Created From Number 1", "TLIDFR2 Yes R N 33 42 10 TIGER/Line ID, Created From Number 2", "TLIDTO1 Yes R N 43 52 10 TIGER/Line ID, Became Number 1", "TLIDTO2 Yes R N 53 62 10 TIGER/Line ID, Became Number 2",) ), ( ("I", "Link Between Complete Chains and Polygons"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number", "FILE No L N 16 20 5 File Code", "RTLINK No L A 21 21 1 Record Type of Link", "CENIDL Yes L A 22 26 5 Census File Identification Code, Left", "POLYIDL Yes R N 27 36 10 Polygon Identification Code, Left", "CENIDR Yes L A 37 41 5 Census File Identification Code, Right", "POLYIDR Yes R N 42 51 10 Polygon Identification Code, Right", "FILLER Yes L A 52 52 1 Filler (to make even character count)",) ), ( ("P", "Polygon Internal Point"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "FILE No L N 6 10 5 File Code", "CENID No L A 11 15 5 Census File Identification Code", "POLYID No R N 16 25 10 Polygon Identification Code", "POLYLONG No R N 26 35 10 Polygon Internal Point Longitude", "POLYLAT No R N 36 44 9 Polygon Internal Point Latitude",) ), ( ("R", "TIGER/Line ID Record Number Range"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "FILE No L N 6 10 5 File Code", "CENID No L A 11 15 5 Census File Identification Code", "MAXID No R N 16 25 10 TIGER/Line ID, Maximum Permanent ID for Census File", "MINID No R N 26 35 10 TIGER/Line ID, Minimum Permanent ID for Census File", "HIGHID No R N 36 45 10 TIGER/Line ID, Current High ID for Census File", "FILLER Yes L A 46 46 1 Filler (to make even character count)",) ), ( ("S", "Polygon Additional Geographic Entity Codes"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "FILE No L N 6 10 5 File Code", "CENID No L A 11 15 5 Census File Identification Code", "POLYID No R N 16 25 10 Polygon Identification Code", "WATER Yes L N 26 26 1 Water Flag", "MSACMSA Yes L N 27 30 4 FIPS Consolidated Metropolitan Statistical Area/Metropolitan Statistical Area Code, 2000", "PMSA Yes L N 31 34 4 FIPS Primary Metropolitan Statistical Area Code, 2000", "AIANHH Yes L N 35 39 5 FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000", "AIANHHCE Yes L N 40 43 4 Census Code (American Indian/ Alaska Native Area/Hawaiian Home Land), 2000", "AIHHTLI Yes L A 44 44 1 American Indian/Hawaiian Home Land Trust Land Indicator, 2000", "RS6 Yes L A 45 46 2 Reserved Space 6", "STATE Yes L N 47 48 2 FIPS State Code, 2000", "COUNTY Yes L N 49 51 3 FIPS County Code, 2000", "CONCIT Yes L N 52 56 5 FIPS 55 Code (Consolidated City), 2000", "COUSUB Yes L N 57 61 5 FIPS 55 Code (County Subdivision), 2000", "SUBMCD Yes L N 62 66 5 FIPS 55 Code (Subbarrio), 2000", "PLACE Yes L N 67 71 5 FIPS 55 Code (Incorporated Place/CDP), 2000", "TRACT Yes L N 72 77 6 Census Tract Code, 2000", "BLOCK Yes L N 78 81 4 Census Block Number, 2000", "CENSUS6 Yes R N 82 82 1 Census Use 6", "CDCU Yes R N 83 84 2 Congressional District Code, Current", "SLDU Yes R A 85 87 3 State Legislative District Code (Upper Chamber), 2000", "SLDL Yes R A 88 90 3 State Legislative District Code (Lower Chamber), 2000", "UGA Yes L A 91 95 5 Oregon Urban Growth Area, 2000", "BLKGRP Yes L N 96 96 1 Census Block Group, 2000", "VTD Yes R A 97 102 6 Census Voting District Code, 2000", "STATECOL Yes L N 103 104 2 Census 2000 Collection State FIPS Code", "COUNTYCOL Yes L N 105 107 3 Census 2000 Collection County FIPS Code", "BLOCKCOL Yes R N 108 112 5 Census 2000 Collection Block Number", "BLKSUFCOL Yes L A 113 113 1 Census 2000 Collection Block Number Suffix", "ZCTA5 Yes L A 114 118 5 ZIP Code Tabulation Area, 2000", "RS8 Yes L A 119 120 2 Reserved Space 8",) ), ( ("Z", "ZIP+4 Codes"), ("RT No L A 1 1 1 Record Type", "VERSION No L N 2 5 4 Version Number", "TLID No R N 6 15 10 TIGER/Line ID, Permanent Record Number", "RTSQ No R N 16 18 3 Record Sequence Number", "ZIP4L Yes L N 19 22 4 +4 Postal Add-On Code, Left", "ZIP4R Yes L N 23 26 4 +4 Postal Add-On Code, Right",) ), ) def dumpRecinfo(rt): sys.stdout.write("class RT%s(BaseRT):\n" % rt[0][0]) sys.stdout.write("\trecinfo = [\n") count = 0 sys.stdout.write("\t\t") for r in rt[1]: count += 1 field = r.split() sys.stdout.write("['%s', %s, %s]," % \ (field[0].lower(), field[4], field[5])) if count % 3 == 0 and r != rt[1][-1]: sys.stdout.write('\n\t\t') elif r == rt[1][-1]: sys.stdout.write('\n') else: sys.stdout.write(' ') sys.stdout.write("\t]\n\n") sys.stdout.write('\tdef __init__(self, raw=None):\n') sys.stdout.write('\t\tBaseRT.__init__(self, raw)\n\n') def dumpComment(rt): sys.stdout.write('#--------------------------------------------------------------------\n') sys.stdout.write("# TIGER Record Type %s: %s\n#\n" % (rt[0][0], rt[0][1])) # pass 1--get strlens maxlen = [0]*8 field = "Field BV Fmt Type Beg End Len Description".split() for i in xrange(len(field)): maxlen[i] = len(field[i]) for r in rt[1]: f = r.split(None, 7) for i in xrange(len(f)): if maxlen[i] < len(f[i]): maxlen[i] = len(f[i]) # print header sys.stdout.write("# ") sys.stdout.write(("%-*s " * 8) % (maxlen[0], field[0], maxlen[1], field[1], maxlen[2], field[2], maxlen[3], field[3], maxlen[4], field[4], maxlen[5], field[5], maxlen[6], field[6], maxlen[7], field[7])) sys.stdout.write('\n') sys.stdout.write("# ") for l in maxlen: sys.stdout.write("-"*l) if l == maxlen[-1]: sys.stdout.write("\n") else: sys.stdout.write(" ") # pass 2--print strings for r in rt[1]: f = r.split(None, 7) sys.stdout.write("# ") sys.stdout.write(("%-*s " * 8) % (maxlen[0], f[0], maxlen[1], f[1], maxlen[2], f[2], maxlen[3], f[3], maxlen[4], f[4], maxlen[5], f[5], maxlen[6], f[6], maxlen[7], f[7])) sys.stdout.write("\n") sys.stdout.write("""# # BV (Blank Value): # \tYes = Blank value may occur here; No = Blank value should not occur here # # Fmt: # \tL = Left-justified (numeric fields have leading zeros and may be interpreted as character data) # \tR = Right-justified (numeric fields do not have leading zeros and may be interpreted as integer data) # # Type: # \tA = Alphanumeric, N = Numeric """) #-MAIN---------------------------------------------------------------------- if len(sys.argv) == 1: fields = "123456789ACHIPRSZ" elif len(sys.argv) != 2 or \ sys.argv[1] == "-h" or \ sys.argv[1] == "--help": sys.stderr.write("usage: mkdd [1-9|A|C|H|I|P|R|S|Z]\n") sys.exit(1) else: fields = sys.argv[1] for rt in dd: if rt[0][0] in fields: dumpComment(rt) dumpRecinfo(rt) sys.exit(0)