Example Product Rule - Log File Maintenance

Scenario: A log file is created or appended to for production samples, that is, where the client code is PRODUCTION.

Sub Main ()
  'Maintain a log file
  dim oFS
  dim oTS
  cDataDir = "C:\CCLASELSQL\"
  On Error Resume Next
  MsgBox "Product Rules " & Chr(13) & Chr(10) & cstr(Now()) & " " & Current.Pro_Job & " " _ 
  & Current.Sampletype & " " & current.Sampleident & " " & current.Sch_Code
  if clsbdprofjob.ProfJob.Cli_Code = "PRODUCTION" then
    Set oFS = CreateObject ("Scripting.FileSystemObject")
    If oFS.FileExists (cDataDir & "\LOGS\SAMPLES.LOG") Then
      set oTS = oFS.OpenTextFile (cDataDir & "\LOGS\SAMPLES.LOG", 8)
    Else
      set oTS = oFS.CreateTextFile (cDataDir & "\LOGS\SAMPLES.LOG")
    End If
    oTS.WriteLine cstr(Now()) & "," & Current.Pro_Job & "," & Current.Sampletype & "," & _
    current.Sampleident & "," & current.Sch_Code
    oTS.Close
    Set oTS = Nothing
    set oFS = Nothing
  End If
End Sub