!BONTEX1.IPF - taking a fresh look at matching - have table of texas taxa !fide bonap - BONTX96A.ITB, full BONAP nomenclatural table - BONAP96A.ITB !in Kcode order and a file for tagging Texas, and the same table with family !and genus records [rankcode=0, 1] removed and sorted by genus/species. So, !will walk through BONTX96A.ITB and take all match strings as vars - then will !use genus string to pluck from BONAP96B.ITB with a walk through all records !carrying that genus name looking for records that FULLY match the name !strings taken from BONTX96A.ITB. Will check full match using breakup of !origina name string to determine rankcode and also check hybrid - will track !matches initially in a 'gotit' field in BONTX96A.ITB finish all !TABLES use bonap96b with bon96bge use bonap96a with bon96ana use bontx96a;default bontx96a !VARIABLES moveit=0;qrank1="";qrank2="";haverank=0;hybrid=false;qhybrid=" ";qinfra1="" qspecies="";spelen=0;inf1len=0;strlen=0;qinfra2="";qinf2len=0;x=0;y=0 texcheck=0 !ENVIRONMENT e.supd=true;e.deci=0;e.lnum=9 !START obtain 1 from bontx96a !DETERMINE RANK if match(bontx96a.fullname,"var.") ne 0 and match(bontx96a.fullname,"ssp.") ne 0 then qrank1="ssp";qrank2="var";haverank=4 endif if haverank = 0 then if match(bontx96a.fullname,"var.") ne 0 then qrank1="var";haverank=3 endif if match(bontx96a.fullname,"ssp.") ne 0 then qrank1="ssp";haverank=3 endif endif !GET GENUS NAME qgenus=substr(bontx96a.fullname,1,match(bontx96a.fullname," ")) !CHECK FOR HYBRID - ALL ARE INTERSPECIFIC if match(bontx96a.fullname," X ") ne 0 then hybrid=true;qhybrid="X " else hybrid=false;qhybrid=" " endif !GET FULL LENGTH OF TRIMMED FULLNAME strlen=len(trim(bontx96a.fullname)) !GET SPECIES NAME FOR RANK 2 if haverank lt 3 then if hybrid=true then qspecies=substr(bontx96a.fullname,match(bontx96a.fullname," x ")+3,strlen) else qspecies=substr(bontx96a.fullname,match(bontx96a.fullname," ")+1,strlen) endif endif !GET SPECIES/INFRA NAME FOR RANK 3 if haverank = 3 then if qrank1="var" then !SET LENGTHS FOR SUBSTRINGS spelen=strlen-match(bontx96a.fullname," ")-1 !TAKE OUT GENUS NAME inf1len=strlen-match(bontx96a.fullname," var.") !GET LENGTH OF INFRA spelen=spelen-inf1len !TAKE OUT INFRA qspecies=substr(bontx96a.fullname,match(bontx96a.fullname," ")+1,spelen) qinfra1=substr(bontx96a.fullname,match(bontx96a.fullname,"var.")+5,inf1len) endif if qrank1="ssp" then !SET LENGTHS FOR SUBSTRINGS spelen=strlen-match(bontx96a.fullname," ")-1 !TAKE OUT GENUS NAME inf1len=strlen-match(bontx96a.fullname," ssp.") !GET LENGTH OF INFRA spelen=spelen-inf1len !TAKE OUT INFRA qspecies=substr(bontx96a.fullname,match(bontx96a.fullname," ")+1,spelen) qinfra1=substr(bontx96a.fullname,match(bontx96a.fullname,"ssp.")+5,inf1len) endif endif !GET SPECIES/INFRAS NAME FOR RANK 4-ALL ARE SSP. THEN VAR. if haverank = 4 then !SET LENGTHS FOR SUBSTRINGS strlen=len(trim(bontx96a.fullname)) genlen=match(bontx96a.fullname," ") spelen=match(bontx96a.fullname,"ssp.")-genlen !TAKE OUT GENUS NAME qinfra2=substr(fullname,match(fullname,"var."),strlen) !INITIAL STRING inf2len=len(trim(qinfra2)) x=match(fullname,"ssp.");y=match(fullname,"var.") inf1len=(y-x)-6 !FILL VARIABLES qspecies=ltrim(substr(bontx96a.fullname,genlen,spelen-1)) qinfra1=substr(bontx96a.fullname,match(bontx96a.fullname,"ssp.")+5,inf1len) qinfra2=substr(bontx96a.fullname,match(bontx96a.fullname,"var.")+5,inf2len) endif clear @6,2?"Current record - BONTX96A.ITB:" @8,2?"Current record - BONAP96A.ITB:" @10,2?"Current record - BONAP96B.ITB:" while moveit=0 do !ACTION if texcheck=0 then default bontx96a;obtain 2 texcheck=1 else default bontx96a;obtain next texcheck=texcheck+1 !CLEAR MATCH VARS qrank1="";qrank2="";hybrid=false;qhybrid=" ";qinfra1="";qinfra2="";qspecies="" qgenus="";spelen=0;inf1len=0;inf2len=0;genlen=0;x=0;y=0 !CLEAR COUNTERS, LENGTHS haverank=0;strlen=0; if currec(bontx96a)=15 then;moveit=1;endif if moveit ne 0 then;break;endif endif !DETERMINE RANK if match(bontx96a.fullname,"var.") ne 0 and match(bontx96a.fullname,"ssp.") ne 0 then qrank1="ssp";qrank2="var";haverank=4 endif if haverank = 0 then if match(bontx96a.fullname,"var.") ne 0 then qrank1="var";haverank=3 endif if match(bontx96a.fullname,"ssp.") ne 0 then qrank1="ssp";haverank=3 endif endif qgenus=substr(bontx96a.fullname,1,match(bontx96a.fullname," ")) !CHECK FOR HYBRID - ALL ARE INTERSPECIFIC if match(bontx96a.fullname," X ") ne 0 then hybrid=true;qhybrid="X " else hybrid=false;qhybrid=" " endif !GET FULL LENGTH OF TRIMMED FULLNAME strlen=len(trim(bontx96a.fullname)) !GET SPECIES NAME if haverank lt 3 then if hybrid=true then qspecies=substr(bontx96a.fullname,match(bontx96a.fullname," x ")+3,strlen) else qspecies=substr(bontx96a.fullname,match(bontx96a.fullname," ")+1,strlen) endif endif !GET SPECIES/INFRA NAME FOR RANK 3 if haverank = 3 then if qrank1="var" then !SET LENGTHS FOR SUBSTRINGS spelen=strlen-match(bontx96a.fullname," ")-1 !TAKE OUT GENUS NAME inf1len=strlen-match(bontx96a.fullname," var.") !GET LENGTH OF INFRA spelen=spelen-inf1len !TAKE OUT INFRA qspecies=substr(bontx96a.fullname,match(bontx96a.fullname," ")+1,spelen) qinfra1=substr(bontx96a.fullname,match(bontx96a.fullname,"var.")+5,inf1len) endif if qrank1="ssp" then !SET LENGTHS FOR SUBSTRINGS spelen=strlen-match(bontx96a.fullname," ")-1 !TAKE OUT GENUS NAME inf1len=strlen-match(bontx96a.fullname," ssp.") !GET LENGTH OF INFRA spelen=spelen-inf1len !TAKE OUT INFRA qspecies=substr(bontx96a.fullname,match(bontx96a.fullname," ")+1,spelen) qinfra1=substr(bontx96a.fullname,match(bontx96a.fullname,"ssp.")+5,inf1len) endif endif !GET SPECIES/INFRAS NAME FOR RANK 4-ALL ARE SSP. THEN VAR. if haverank = 4 then !SET LENGTHS FOR SUBSTRINGS strlen=len(trim(bontx96a.fullname)) genlen=match(bontx96a.fullname," ") spelen=match(bontx96a.fullname,"ssp.")-genlen !TAKE OUT GENUS NAME qinfra2=substr(fullname,match(fullname,"var."),strlen) !INITIAL STRING inf2len=len(trim(qinfra2)) x=match(fullname,"ssp.");y=match(fullname,"var.") inf1len=(y-x)-6 !FILL VARIABLES qspecies=ltrim(substr(bontx96a.fullname,genlen,spelen-1)) qinfra1=substr(bontx96a.fullname,match(bontx96a.fullname,"ssp.")+5,inf1len) qinfra2=substr(bontx96a.fullname,match(bontx96a.fullname,"var.")+5,inf2len) endif !HAVE SEARCH VARIABLES FROM BONTX96A - NOW FIND IN BONAP96A !GENUS=qgenus-HYBRID2=qhybrid-SPECIES=qspecies-INRANK1=qrank1 !INRANK2=qrank2-INNAME1=qinfra1-INNAME2=qinfra2-RANKCODE=haverank @6,33?CURREC(BONTX96A) default bonap96b pluck qgenus @10,33?CURREC(BONAP96B) if #found=false then clear;@10,2?"No match for genus: ",qgenus wait endif !GET RECORD FOR RANK LT 3 - NORMAL AND HYBRIDS if haverank lt 3 then if bonap96b.species ne qspecies and bonap96b.hybrid2 ne qhybrid then obtain next for bonap96b.genus=qgenus and bonap96b.hybrid2=qhybrid and bonap96b.species=qspecies endif endif if #found=false then clear;@10,2?"No match for species: ",qgenus,qhybrid,qspecies wait endif @10,33?CURREC(BONAP96B) endwhile !OUT release moveit,qrank1,qrank2,haverank,hybrid,qhybrid,qinfra1 release qspecies,spelen,inf1len,strlen,qinfra2,qinf2len,x,y,texcheck finish all e.supd=false return