User Rick Jones ( posted:

Here's a little toy to play with a master log file as structured for v2000

Sub Main
Dim i%, j%, intChar%, intFileLen%
Dim intSectCntr%, intResult%, intFileNumber%
Dim strMasterLog$, strTemp$
Dim strChar As String*1
Dim aLogFile() As String*1
Dim aSectLoc() As Integer

' strMasterLog = "logspath\Master.log"

'you can get the log's path using SQAGetLogDir within the test script
'that you wish to retrieve the log information. Remember, you can't open
'a log while the script is running, this code must be run after the test
'script has completed.

If Dir$(strMasterLog) <> "" Then

intFileNumber = FreeFile

Open strMasterLog For Random As #intFileNumber Len=1
intFileLen = Lof(intFileNumber)
Redim aLogFile(intFileLen)
For i = 1 To intFileLen
Get #intFileNumber ,, aLogFile(i)
'intChar = Asc(aLogFile(i))
'strTemp = strTemp & Str$(intChar)
Close #intFileNumber
'array aLogFile now contains the contents of the log file
'each element in the array contains one byte from the file

'the file section separator, occurs at the 14th byte for every log file

'now traverse the array and identify the sections, identifiers will be
'saved in the SectLoc array
Redim aSectLoc(1)
'set the first section to zero
intSectCntr = 1
aSectLoc(intSectCntr) = 0

'start at 16 since we know that's where the first separator ends (third byte)
For i = 16 To intFileLen
If aLogFile(i) = aLogFile(16) And aLogFile(i-1) = aLogFile(15) _
And aLogFile(i-2) = aLogFile(14) Then
intSectCntr = intSectCntr + 1
Redim Preserve aSectLoc(intSectCntr)
'set the section locator array to i + 1 (next byte)
aSectLoc(intSectCntr - 1) = i + 1
End If

'now lets look at each section
For i = 1 To intSectCntr - 1
strTemp = ""
For j = aSectloc(i) To aSectloc(i+1)
intChar = Asc(aLogFile(j))
If intChar > 31 And intChar < 127 Then
strTemp = strTemp & aLogFile(j)
End IF

'in the second to last section at offset 2 is the overall result
'1 = pass, 2 = fail
intResult = Asc(aLogFile(aSectloc(intSectCntr - 2)+2))

End If

End Sub