This is an example using a modified version of the UDF mentioned earlier:
Code:
$aArray1="abc#123#456","def#123#456","ghi#123#456","xyz#123#456"
$aArray2="abc#123#456","ghi#999#999","xyz#123#456"

"Results of compare:"+@CRLF
udfCompareArray($aArray1,$aArray2,"#")

Function udfCompareArray($avList1,$avList2,Optional $sDelimiter)
Dim $iIndex1,$iIndex2
$iIndex1=0
$iIndex2=0
If Not $sDelimiter $sDelimiter=@CRLF EndIf
While $iIndex1<=UBound($avList1) OR $iIndex2<=UBound($avList2)
Select
Case $iIndex1>UBound($avList1)
$udfCompareArray=$udfCompareArray+@CRLF+$avList2[$iIndex2]+" missing from array 1"
$iIndex2=$iIndex2+1
Case $iIndex2>UBound($avList2)
$udfCompareArray=$udfCompareArray+@CRLF+$avList1[$iIndex1]+" missing from array 2"
$iIndex1=$iIndex1+1
Case Split($avList1[$iIndex1],$sDelimiter)[0] > Split($avList2[$iIndex2],$sDelimiter)[0]
$udfCompareArray=$udfCompareArray+@CRLF+$avList2[$iIndex2]+" missing from array 1"
$iIndex2=$iIndex2+1
Case Split($avList2[$iIndex2],$sDelimiter)[0] > Split($avList1[$iIndex1],$sDelimiter)[0]
$udfCompareArray=$udfCompareArray+@CRLF+$avList1[$iIndex1]+" missing from array 2"
$iIndex1=$iIndex1+1
Case "Match"
If $avList2[$iIndex2]<>$avList1[$iIndex1]
$udfCompareArray=$udfCompareArray+@CRLF+"'"+$avList1[$iIndex1]+"' values do not match '"+$avList2[$iIndex2]+"'"
EndIf
$iIndex1=$iIndex1+1
$iIndex2=$iIndex2+1
EndSelect
Loop
$udfCompareArray=SubStr($udfCompareArray,3)
EndFunction



The UDF had been modified to allow an optional field delimiter.

To use this compare function:
  • Load each of the files into an array using something like the ReadFile() UDF
  • The key field must be the first field.
  • The arrays must be sorted in ascending alphanumeric order. You may either sort the files first, or use the quick sort QS() UDF to sort the arrays once they have been loaded.