By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,557 Members | 1,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,557 IT Pros & Developers. It's quick & easy.

Send data to 3270 terminal from VB

P: 92
I have to read from from IBM terminal 3270. When the main menu is open I can send my keys and move the page forward. I mean I can send F6,F7,F2 and other keys to go to the page that I want. Then I am sending shift+F8.
When I am doing that the mouse will focus on a line that I have to write a name on it.
I have to read this from array that first time go and read the first name, then second name and so on. But because I was not successful to do it from array so I just wanted to test and say write this name but again I was not successful.
I would appreciate any help.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Save_Record_Click()
  3.        Set ReflectionIBM = CreateObject("ReflectionIBM.Session")
  4.        AppActivate ("ref.rsf")        
  5.        teamleader = "dfh"
  7.        SendKeys "{F6}"        
  8.        SendKeys "{F7}"       
  9.        SendKeys "{F2}"        
  10.        SendKeys ("+{f8}")     
  12. End Sub
Nov 27 '07 #1
Share this Question
Share on Google+
8 Replies

Expert 5K+
P: 8,434
Can you give us some idea of what you mean when you say it was "not successful"?
Nov 28 '07 #2

P: 92
Sorry for not being clear.
it means that i cant read my array
now i did something like this it is working but nit working properly

Dim i As Long
Set ReflectionIBM = CreateObject("ReflectionIBM.Session")
AppActivate ("ref.rsf") 'Activate
MyTeamLeader = Array("DKK", "POI", "NJO", "MNU", "BJU", "DNM", "F7P", "PLM", "JKB", "JEF")

SendKeys "{F6}"
SendKeys "{F7}"
SendKeys "{F2}"
SendKeys ("+{f8}")
i = 0
Do Until i = 9
TL = MyTeamLeader(i)

SendKeys TL

SendKeys ("+{f8}")

i = i + 1

now it is going one page after but the problem is that it is writing the first two letters of the next team leader in front of first column (each row one letter) and the mouse is also located in 2nd row.
it seems that i do not have control of my screen.

Nov 28 '07 #3

Expert 5K+
P: 8,434
Perhaps it's a timing issue. 3270 screens usually take a while to finish an operation and unlock the keyboard. Have you tried pausing in the loop, or using the "wait for this to be handled" option on the SendKeys?

By the way, I'd recommend using a For loop here rather than a Do loop.
Nov 28 '07 #4

P: 92
I can't do sleep or wait, then it will give me an error.
Nov 28 '07 #5

Expert 5K+
P: 8,434
What error?
Nov 28 '07 #6

P: 92
I was thinking maybe if I can create a macro in my application and then copy the page and write into the text file and then read it from text file may be easier.

I could make a macro and also select the area that I want but now I don't know how I can paste or write it into a text file.

Is there any idea?

Nov 29 '07 #7

Expert 5K+
P: 8,434
It certainly doesn't sound easier.

I think the best approach is to work out what is wrong and fix it, rather than using a much more complex workaround.
Nov 29 '07 #8

P: 92
i really try every thing but not working
i cant put wait if i work like that so it will jumo to the second line.
and my .session is not working
but if i make the macro inside the application itself the i can do something like this
Sub Macro4()
With Session
.WaitForEvent rcEnterPos, "30", "0", 1, 1
.TransmitTerminalKey rcIBMPf6Key
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 3, 60
.WaitForDisplayString "ID:", "30", 3, 55
.TransmitTerminalKey rcIBMPf7Key
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 1, 1
.TransmitTerminalKey rcIBMPf2Key
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 23, 55
.WaitForDisplayString "TEAM", "30", 23, 50
.TransmitTerminalKey rcIBMPf20Key
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 23, 55
.WaitForDisplayString "TEAM", "30", 23, 50
.TransmitANSI "DDM"
.TransmitTerminalKey rcIBMPf20Key
.SetMousePos 1, 1
.TerminalMouse rcLeftClick, rcMouseRow, rcMouseCol
.GraphicsMouse rcLeftClick, rcCurrentGraphicsCursorX, rcCurrentGraphicsCursorY
.SetSelectionStartPos 1, 2
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 1, 1
.ExtendSelectionRect 20, 80
.SetMousePos 10, 28
End With
End Sub

but i dontr kn w how to wait in the other format.

thanks alot
Nov 29 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.