I have these routines:
BussOrIndPopArray
Code: Select all
common /BussOrIndv/ a, aNumVals
* The second field in the array denotes where the substring
* will occur: l = Left, r = Right, a = Anywhere in the str.
a = ""
a<-1> = "engineering" : @VM : "a"
a<-1> = "inc." : @VM : "r"
a<-1> = "limited" : @VM : "r"
a<-1> = "stores" : @VM : "a"
a<-1> = "consult" : @VM : "a"
etc...
aNumVals = dcount(a, @FM)
Ans = "Y"
Code: Select all
common /BussOrIndv/ a, aNumVals
Ans = aNumVals
return(Ans)
CleanEntityName = downcase(trim(EntityName))
found = 0
for i = 1 to aNumVals
begin case
* If the occurrence may be anywhere in the string...
case a<i,2> = "a"
found = index(CleanEntityName, a<i,1>, 1)
* If the occurrence must be at the left of the string...
case a<i,2> = "l"
found = index(left(CleanEntityName, len(a<i,1>)), a<i,1>, 1)
* If the occurrence must be at the right of the string...
case a<i,2> = "r"
found = index(right(CleanEntityName, len(a<i,1>)), a<i,1>, 1)
end case
if found > 0
then
Ans = "B"
exit
end
next i
if found = 0
then
Ans = "I"
end
return(Ans)
Code: Select all
if ArrayCreated = "Y" then "Y" else BussOrIndvPopArray("DummyArg")