1

At work I must extract data from an AS400 screen using IBM i Access Client Solutions.

I used to have code that I could use with PComm; however, they recently replaced the software in my company (without asking) and that is causing delays of up to several days.

Here is the old code I had:

Option Explicit

Sub JDE()
' Uses Microsoft forms 2.0 object libraries as references
' You must have Pcomm from IBM installed for this to work:
' https://www.ibm.com/us-en/marketplace/personal-communications
    Dim autECLSession, autECLOIA, autECLPS, autECLConnList As Object
    Dim JDE, Enter, Load, F1, F2, F3, F4, F5, ShF4, PageDown, PageUp, Clear As String

    Set autECLSession = CreateObject("Pcomm.autECLSession")
    Set autECLOIA = CreateObject("Pcomm.autECLOIA")
    Set autECLPS = CreateObject("Pcomm.autECLPS")
    Set autECLConnList = CreateObject("PCOMM.autECLConnList")
    autECLSession.SetConnectionByName "A"

    Set JDE = autECLSession.autECLPS
    Set Load = autECLSession.autECLOIA

    Enter = "[enter]"
    F1 = "[pf1]"
    F2 = "[pf2]"
    F3 = "[pf3]"
    F4 = "[pf4]"
    F5 = "[pf5]"
    ShF4 = "[pf15]"
    PageDown = "[Roll up]"
    PageUp = "[Roll down]"
    Clear = "[erase eof]"

    ' Extracting text
    Selection= JDE.GetText (10, 64, 10(spaces required))

    ' Navigating JDE
    Load.waitforappavailable
    Load.WaitForInputReady
    JDE.SendKeys F1
    JDE.SendKeys F2
    JDE.SendKeys F3
    JDE.SendKeys F4
    JDE.SendKeys ShF4
    JDE.SendKeys Clear
    JDE.SendKeys PageDown
    JDE.SendKeys PageUp

End Sub

The example above helps me navigate the screens by sending several keystrokes and to extract some text to memory.

4

0 回答 0