Consultor Eletrônico



Kbase P112270: Wscript can't capture probkup error level
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Unverified

FACT(s) (Environment):

Windows 32 Intel

SYMPTOM(s):

Wscript can't capture probkup error level

running probkup from a Wscript

oShell.Run ("$DLC\bin\probkup online " & "\" & sp2k & ".db " & "\backup" & sp2k & ".bkp",0, TRUE)

Check for error using object Err
If iRetorno <> 0 or Err.Number <> 0 Then
oShell.PopUp "Error during execution: " & <dbname> & ".db",30,"Error"
End If

CAUSE:

The Run method returns an integer. The Run method starts a program running in a new Windows process. In this case the IF statement will be out of scope keeping Err.Number always as 0. There is another issue here: Err.Number returns a integer and probkup does not always return a integer.
0 if successful
-1 if ai enabled
EXPARM if Volume size < blocking factor
EXBAD if error encountered


FIX:

Use a .bat file to call probkup and manipulate the error level.