While I am checking what that error means and what could be causing that I would like to suggest an alternative method for message logging Dim fso, logFile Set fso = CreateObject("Scripting.FileSystemObject") Set logFile = fso.OpenTextFile("C:\Program Files\24x7 Automation 3\schedule.log", 2, True) logFile.WriteLine "INFO" & vbTab & "@V"job_id"" & vbTab & "@V"job_name"" & vbTab & "0" & vbTab & "DB2 returned an error" logFile.Close : I have many VB scripts that execute JAL commands, : and it works most of the time. However, I sometimes : get the error 24 "Unable to register JALScript : Interface object" : This causes a lot of trouble, because I do not want : to trap for this error. Do you have any suggestions? : A sample of code for which I sometimes get the : error follows. : Sub Main() : 'Declare and get objects : Dim objCmd : Set objCmd = CreateObject("ADODB.Command") : 'Run the test command : objCmd.ActiveConnection = "Provider=SQLOLEDB; Data Source=NLGPFMGSQL14; : Initial Catalog=DatamartRob; Integrated Security = SSPI;" : objCmd.CommandType = 1 'Text : objCmd.CommandText = "SELECT * FROM OPENQUERY(WAREDB2A,'SELECT 1 AS : DRSD_TRANS_DT FROM WAREHSEP.AGY_PROD_GRP_VW')" : objCmd.Execute() : If Err.Number 0 Then : JalCommand = "LogAddMessageEx ""INFO""" & : "," & : """@V"job_id"""" & : "," & : """@V"job_name"""" & ", : ""DB2 returned an error""" + vbCrLf : JALScript.Execute(JalCommand) : Set objCmd = Nothing : Else : JalCommand = "LogAddMessageEx ""INFO""" & : "," & : """@V"job_id"""" & : "," & : """@V"job_name"""" & ", : ""DB2 available - generating semaphore file for step : 03""" + vbCrLf : JALScript.Execute(JalCommand) : Dim fso, outFile : Set fso = CreateObject("Scripting.FileSystemObject") : Set outFile = fso.CreateTextFile("E:\Datamart\SalesReporting\03 Exec : SalesReporting usp00GetDB2Data.24x7", True) : outFile.Close : fso.DeleteFile("E:\Datamart\SalesReporting\02 Test for DB2 : Availability.24x7") : Set fso = Nothing : Set objCmd = Nothing : End If : End Sub
|