Is there a way to test for a program that has gone onto message wait on an AS400 system?
My VB program is currently hanging because the AS400 program is expecting a reponse due to a function check etc. I've tried a couple of different methods...
Method 1 - ADODB.Connection
Program just hangs at con400.Execute...
Method 2 - IBM Client Access Express Activex ObjectsCode:Private Function ExecuteAS400Cmd(ByRef con400 As ADODB.Connection, strCmd As String) As Boolean On Error GoTo AS400_Error con400.Execute "CALL QSYS.QCMDEXC('" & strCmd & "', " & Format(Len(strCmd), "0000000000") & ".00000)" ExecuteAS400Cmd = True AS400_Resume: Exit Function AS400_Error: Dim lErrNo As Long Dim sErrMSG As String Dim sErrSource As String With Err lErrNo = .Number sErrMSG = .Description sErrSource = .Source End With Err.Raise lErrNo, sErrMSG, sErrSource Resume AS400_Resume End Function
Program hangs at objAS400Command.Run
Does anyone have any idea how to execute the command, then test for the response, handling any possible MSGW status or other errors on the AS400 system?Code:Private Function IBMExecuteCommand(SystemName As String, CommandString As String) As Boolean Dim objAS400Command As cwbx.Command '// Create new command object Set objAS400Command = New cwbx.Command '// Create new as400 system object Set objAS400Command.System = New cwbx.AS400System '// Define the system and sign on With objAS400Command .System.Define SystemName .System.UserID = "MYUSER" .System.Password = "MYPASSWORD" .System.Signon End With '// Run the command objAS400Command.Run CommandString If objAS400Command.Errors.Count > 0 Then Else IBMExecuteCommand = True End If End Function
Thanks




Reply With Quote