Hi,
Iam trying to automate a certain process in mainframes.
Initially, I wrote a macro to connect to PComm using the IBM link: http://publib.boulder.ibm.com/infocenter/pcomhelp/v5r9/index.jsp?topic=/com.ibm.pcomm.doc/books/html/host_access08.htm
The macro opens a Pcomm session.
But, 1. Iam unable to use the settext method to type in the mainframe screen.It does'nt work
2.When i try to retrieve the cursor position, it returns the position (1,1) though the actual position is (3,15)
3.The inputinhibit method used below returns 'Communication check'. I need to get 'Not Inhibited' instead
Please have a look at my code below, and let me know where I might be wrong, or could have missed something.
Is the macro not able to connect?
Also let me know if further details are required.
Thanks,
CODE:
Sub step()
'Connect Macro
' Application.Goto Reference:="connect"
ChDir "C:\Documents and Settings\sr123\Desktop"
'ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\sr123\Desktop\cktmac.xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
'Object declaration
Dim Mgr As Object
Dim Num As Long
Dim autECLOIA As Object
Dim autECLPSObj As Object
Dim autECLConnList As Object
Dim CurPosRow As Long
Dim CurPosCol As Long
Dim SessObj As Object
'object creation
Set Mgr = CreateObject("PCOMM.autECLConnMgr")
Num = Mgr.autECLConnList.Count
Set autECLOIA = CreateObject("PCOMM.autECLOIA")
Set autECLPSObj = CreateObject("PCOMM.autECLPS")
Set autECLConnList = CreateObject("PCOMM.autECLConnList")
Set SessObj = CreateObject("PCOMM.autECLSession")
'setting connections
autECLOIA.SetConnectionByName ("B")
autECLPSObj.SetConnectionByName ("C")
SessObj.SetConnectionByName ("D")
autECLConnList.SetConnectionByName ("E")
'start a new connection
Mgr.StartConnection ("profile=a74ism.WS connname=A")
'Checking whether connected
TestConnection
startcommunication
autECLOIA.WaitForInputReady (7000)
autECLConnList.Refresh
'Checking for input inhibit
If autECLOIA.InputInhibited = 0 Then MsgBox "Not Inhibited "
If autECLOIA.InputInhibited = 1 Then MsgBox "System Wait "
If autECLOIA.InputInhibited = 2 Then MsgBox "Communication Check "
If autECLOIA.InputInhibited = 3 Then MsgBox "Program Check "
If autECLOIA.InputInhibited = 4 Then MsgBox "Machine Check "
If autECLOIA.InputInhibited = 5 Then MsgBox "Other Inhibit "
'CURSOR POSITION CHECKING
CurPosRow = autECLPSObj.CursorPosRow
CurPosCol = autECLPSObj.CursorPosCol
MsgBox " ROW= " & CurPosRow
MsgBox " COL= " & CurPosCol
autECLPSObj.settext "A74ISM", 3, 15
MsgBox "crossed"
End Sub
*********************************************************************
(The main code ends here.. the below two code blocks are being called in the above program)
Sub TestConnection()
Dim Hand As Long
Dim Obj As Object
Set Obj = CreateObject("PCOMM.autECLOIA")
' Initialize the connection
Obj.SetConnectionByName ("A")
Do
Obj.WaitForInputReady (2500)
Loop While (Obj.Started = "False")
If Obj.Started = "True" Then
MsgBox "Started"
Else
MsgBox "Not - Started"
End If
End Sub
Sub startcommunication()
Dim PSObj As Object
Dim autECLConnList As Object
Set autECLConnList = CreateObject("PCOMM.autECLConnList")
Set PSObj = CreateObject("PCOMM.autECLPS")
' Initialize the session
autECLConnList.Refresh
PSObj.SetConnectionByHandle (autECLConnList(1).Handle)
PSObj.startcommunication
End Sub
Iam trying to automate a certain process in mainframes.
Initially, I wrote a macro to connect to PComm using the IBM link: http://publib.boulder.ibm.com/infocenter/pcomhelp/v5r9/index.jsp?topic=/com.ibm.pcomm.doc/books/html/host_access08.htm
The macro opens a Pcomm session.
But, 1. Iam unable to use the settext method to type in the mainframe screen.It does'nt work
2.When i try to retrieve the cursor position, it returns the position (1,1) though the actual position is (3,15)
3.The inputinhibit method used below returns 'Communication check'. I need to get 'Not Inhibited' instead
Please have a look at my code below, and let me know where I might be wrong, or could have missed something.
Is the macro not able to connect?
Also let me know if further details are required.
Thanks,
CODE:
Sub step()
'Connect Macro
' Application.Goto Reference:="connect"
ChDir "C:\Documents and Settings\sr123\Desktop"
'ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\sr123\Desktop\cktmac.xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
'Object declaration
Dim Mgr As Object
Dim Num As Long
Dim autECLOIA As Object
Dim autECLPSObj As Object
Dim autECLConnList As Object
Dim CurPosRow As Long
Dim CurPosCol As Long
Dim SessObj As Object
'object creation
Set Mgr = CreateObject("PCOMM.autECLConnMgr")
Num = Mgr.autECLConnList.Count
Set autECLOIA = CreateObject("PCOMM.autECLOIA")
Set autECLPSObj = CreateObject("PCOMM.autECLPS")
Set autECLConnList = CreateObject("PCOMM.autECLConnList")
Set SessObj = CreateObject("PCOMM.autECLSession")
'setting connections
autECLOIA.SetConnectionByName ("B")
autECLPSObj.SetConnectionByName ("C")
SessObj.SetConnectionByName ("D")
autECLConnList.SetConnectionByName ("E")
'start a new connection
Mgr.StartConnection ("profile=a74ism.WS connname=A")
'Checking whether connected
TestConnection
startcommunication
autECLOIA.WaitForInputReady (7000)
autECLConnList.Refresh
'Checking for input inhibit
If autECLOIA.InputInhibited = 0 Then MsgBox "Not Inhibited "
If autECLOIA.InputInhibited = 1 Then MsgBox "System Wait "
If autECLOIA.InputInhibited = 2 Then MsgBox "Communication Check "
If autECLOIA.InputInhibited = 3 Then MsgBox "Program Check "
If autECLOIA.InputInhibited = 4 Then MsgBox "Machine Check "
If autECLOIA.InputInhibited = 5 Then MsgBox "Other Inhibit "
'CURSOR POSITION CHECKING
CurPosRow = autECLPSObj.CursorPosRow
CurPosCol = autECLPSObj.CursorPosCol
MsgBox " ROW= " & CurPosRow
MsgBox " COL= " & CurPosCol
autECLPSObj.settext "A74ISM", 3, 15
MsgBox "crossed"
End Sub
*********************************************************************
(The main code ends here.. the below two code blocks are being called in the above program)
Sub TestConnection()
Dim Hand As Long
Dim Obj As Object
Set Obj = CreateObject("PCOMM.autECLOIA")
' Initialize the connection
Obj.SetConnectionByName ("A")
Do
Obj.WaitForInputReady (2500)
Loop While (Obj.Started = "False")
If Obj.Started = "True" Then
MsgBox "Started"
Else
MsgBox "Not - Started"
End If
End Sub
Sub startcommunication()
Dim PSObj As Object
Dim autECLConnList As Object
Set autECLConnList = CreateObject("PCOMM.autECLConnList")
Set PSObj = CreateObject("PCOMM.autECLPS")
' Initialize the session
autECLConnList.Refresh
PSObj.SetConnectionByHandle (autECLConnList(1).Handle)
PSObj.startcommunication
End Sub