Example of how to take duplicate numbers that have been dialed and combine them into a single record
The spec file COMBINEDUPFONNUMBS.SPX is an example that takes duplicate numbers that have both been dialed and combine them as best as possible into a single record. You might want to use this if you are converting a .FON file that allowed duplicates, to one that does not.
Highlights of what it does.
- Combines History information from both records. History information is NOT sorted by call time and will not contain increasing call numbers.
- If both duplicates are resolved. Takes Resolve Status of the first, unless 2nd one is Complete.
- If one duplicate is resolved and the other is not, take all information from the resolved one.
- If one record is not dialed and other is, take information from dialed record.
- If both records are dialed and still active then take the information from the record that was call the least time in the past.
- History information is always appended and fields that can be added such as number of attempts are always added.
>PurgeSame''Make sure following define statements are set properly>Define @Input Dupes.ASC>Define @InputOpt ASCII=2576 ''Fone_Format>Define @Output Dupes.Fix>Define @MaxHistories 10>Define @FileLength 1496~DefEntireRec:[1.2576$]PhoneNum:[1.10$]TextArea:[51.900$]BVar:[951.4]PrevRec:[(Bvar) 1.2]NextRec:[(Bvar) 3.2]NumAtts:[1005.5]StackNum:[1020.5]SuspName:[1048.10$]CaseIDX:[1081.10$]FinStat:[1111.3]NumCalls:[1114.3]MaxHist:[1117.3]Where2Go:[1161.15$]LastHist:[1200.27$]LastCallTime:[1209.10]History:[1227.1350$]~In @Input @InputOpt~Out Dupes.SRT,ASCII,TrimBlanks~Sort PhoneNum BreakVar=BVar~In Dupes.SRT,ASCII=2576,NumBuf=2,Study=Orig~In $,Length=6000,NewBuf,Study=Temp~Out @Output ,ASCII,Length=@FileLength,Trimblanks~DefProc= Combineit:If FirstCaseChoosefile "Temp"Next FirstChoosefile "Orig"Endif''These records do not have a duplicateIf PrevRec < 2 and NextRec < 2WriteCaseError Summary_Only "No Dupe Here"Goto DoneEndif''These records are the first duplicate in a setIf PrevRec < 2 and NextRec = 2Copy Temp!EntireRec = EntireRecError Summary_Only "First Dupe"Goto DoneEndif''These records duplicate a previous record''Current Dupe has no attempts, Don't bother with itIf NumCalls = 0Goto WriteEndif''Append History InfoModify Temp![1227.3000$] = Strip(Temp!History) Join Strip(History)''Add AttemptsModify Temp!NumAtts += NumAtts''Add Number of CallsModify Temp!NumCalls += NumCalls''Add Number of Attempts in Each Day Part>Repeat $A=1073,1075,1077,1079Modify Temp![$A.2] += [$A.2]>EndRepeat''Add Number of HistoriesModify Temp!MaxHist = Min(@MaxHistories,Temp!MaxHist+MaxHist)''Take First Suspend Name if there are multiple of themIf Temp![SuspName ^B] And [SuspName ^NB]Copy Temp!SuspName = SuspNameEndif ''Current Dupe is Resolved - Take it unless previous Dupe was a Resolve or''if this is a completeIf (StackNum = 314 And Temp!StackNum <> 314) or FinStat = 1Copy Temp!Where2Go = Where2GoCopy Temp!StackNum = StackNumCopy Temp!FinStat = FinStatCopy Temp!TextArea = TextAreaIf FinStat = 1Copy Temp!CaseIDX = CaseIDXEndifGoto WriteEndif''Previous Record is Resolved, This one Not - No more to doIf Temp!StackNum = 314Goto WriteEndif''If more than one dupe active take the where2go from the latest time attemptIf LastCallTime >= Temp!LastCallTimeModify Temp!Where2Go = Where2GoModify Temp!StackNum = StackNumModify Temp!LastHist = LastHistModify Temp!TextArea = TextAreaGoto WriteEndifWrite:''Last Duplicate so time to write out all the Temp InfoIf NextRec < 2Choosefile "Temp"WriteCaseBlank Temp![1.6000$]EndifDone:}~Exc Proc=CombineIt on Orig~End