Hello
I have to start an as400 program from a vb6 program and I am having some problems...
1) gives me the following error = CPF0006: Errors occurred in command.
Cause . . . . . : If the wrong length was passed on one part of the command, other messages are issued because the wrong part of the command is being analyzed. Recovery . . . : See the previously listed messages in the job log. Correct the errors and then try the command again.
2) gives me the following error CPF0006 - Errors occurred in command.
3) My vb program hangs on the cmdtest.Execute line and I have to close it with task manager
Can anyone help me finding what I am doing wrong?
Greetz
VBMim
I have to start an as400 program from a vb6 program and I am having some problems...
Code:
Function testfunction()
On Error GoTo handler
Dim as400Connection As New ADODB.Connection
as400Connection.ConnectionString = strconnAs400
as400Connection.Open
Dim cmdtest As New ADODB.Command
Set cmdtest.ActiveConnection = as400Connection
'1
cmdtest.CommandText = "CALL QSYS.QCMDEXC('CALL PGM (MYLIB/MYPROGRAM)', 0000000026.00000)"
'2
Str = "MYPROGRAM"
cmdtest.CommandText = "{{call qcmdexc ('" & Str & "', " & Format$(Len(Str), "0000000000.00000") & ")}}"
'3
cmdtest.CommandText = "{{call /QSYS.LIB/MYLIB.LIB/MYPROGRAM.PGM}}"
cmdtest.Execute
Set cmdtest = Nothing
as400Connection.Close
Set as400Connection = Nothing
Exit Function
handler:
If as400Connection.State = 1 Then
as400Connection.Close
End If
Set as400Connection = Nothing
Set cmdtest = Nothing
End Function
1) gives me the following error = CPF0006: Errors occurred in command.
Cause . . . . . : If the wrong length was passed on one part of the command, other messages are issued because the wrong part of the command is being analyzed. Recovery . . . : See the previously listed messages in the job log. Correct the errors and then try the command again.
2) gives me the following error CPF0006 - Errors occurred in command.
3) My vb program hangs on the cmdtest.Execute line and I have to close it with task manager
Can anyone help me finding what I am doing wrong?
Greetz
VBMim