AS400 SendKeys not sending data to screen

bigeldm

New Member
Joined
Apr 25, 2013
Messages
12
I have a very simple module that connects to AS400 and sends "022" to the screen but the "022" never shows up on the screen when I run this. I know I'm making a connection because the gettext line returns data.

What am I missing? Any help wuld be greatly appreciated. TX

Here is the code
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public autECLSession As Object
Public autECLPS As Object
Public autECLOIA As Object
Sub ObjGetExtra()
Set autECLSession = CreateObject("pcomm.auteclsession")
Set autECLPS = CreateObject("Pcomm.auteclps")
Set autECLOIA = CreateObject("Pcomm.autecloia")
autECLSession.SetConnectionByName ("A")
autECLSession.autECLPS.SetCursorPos 24, 17
autECLSession.autECLPS.SendKeys ("022")
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"
autECLSession.autECLOIA.WaitForInputReady
MsgBox autECLSession.autECLPS.GetText(6, 7, 15)
End Sub
 
Thank you for trying my code and verifying that it does work. I'm not sure where or how the emulator would / could be blocked and had some suspicions that this may be happening. Does anyone happen to know that their are ways to block the emulator for write access like this? I can read from the screens just fine. I just can't write with code (I can manually enter what I want - I just can't get the code to write to the screens).
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
bigeldm,

do you have access to AS400 help file? the one in our company's has :

Using the Keyboard (in main windows)
If you do not have a mouse, you can use the following keys in Personal Communications:
Key Action
Alt Toggle between menu-bar and window
cursor keys Move a selection in menu-bar
Enter Select the menu-command
Alt + Space Uses the System Menu
Ctrl + Esc Use the Start Menu
Alt + char Use Mnemonics for fast access to menus (char is any valid character)
Using the Keyboard (In Pop-up Windows)
Use the following keys in pop-up windows; a pop-up is a window in which you enter or select specific options.
Key Action
Tab Move the selection between items
Cursor keys Move the selection between choices
Alt + char Use Mnemonics for fast access to fields (char is any valid character)
Using the Keyboard (in the host-session windows)
Please refer to the Function (Key-Action) Help section.
Not Using the Keyboard
If you have a mouse, you can minimize use of the keyboard by using:

· Hotspots
· Macros
· Popup Keypad
· Perform Keyboard Function
· Keyboard Customization

Then when you click on
Code:
Using the Keyboard (in the host-session windows) Please refer to the Function (Key-Action) Help section.
then you will see whether a certain option of keyboard in host session is allowed or not. From the list of available in our company I copied:
Code:
Edit Paste invokes the Paste edit function. If there is not enough space on the screen for all the information that you have copied to the clipboard, you can use Paste Next to paste the information into more than one screen. 
Token-name          edit-paste 
Face-name          EditPst 
 Available 
Keyboard          Yes 
Popup Keypad          Yes 
Mouse          Yes 
Macro          Yes 
Keyboard/Macro Function          Yes 
3270 SBCS          Yes 
3270 DBCS          Yes 
3270 AEA (SBCS)          Yes 
5250 SBCS          Yes 
5250 DBCS          Yes 
VT SBCS          Yes
than explains that 'Edit paste' is allowed in Macro functions.

So maybe you need to go check there some edit options?

Ultimately, there should be IS team in your company that know it better than I do? They should at least know whether you could write on-screen macros or not.
Try with them - I realize they may not be willing to share their 'secret knowladge' or whatever the (other) reason but as long as you write your macros alone and they do not need to spend time on it, maybe they will help out a bit?
 
Upvote 0
Thanks for this reply. It appears we are all set like your's above. I hear you on the IT thing but I've tried that path and got nowhere. If this is a setup issue at this point I'm going to have to go to management to get it dealt with but first I need to determine what needs changing if anything to make this work. I'm wondering if I'm doing this incorrectly to begin with.

This may sound like a strange question but when you talk about an emulator what do you mean? Do I need something installed separate from just the mainframe session I have on my desktop that was set up by IT? Here is how I am trying to run this:

- I go to my desktop and start my session
- I log into the session and navigate to the first menu screen
- I run the code to write 022 to the screen and nothing happens

I downloaded a trial version of a software called automate thinking that perhaps it would throw an error that would tell me what was wrong with our setup that would lead me in the right direction. Much to my surprise it WORKED - it opens a session, logs in, navigates to the correct screen, writes 022 successfully. The only difference is that the software opens the screen through a terminal emulator window and it doesn't touch my local session - it just goes straight to the host. Am I missing something in my setup to run this?
 
Upvote 0
This looks so much more impressive in Polish :)

I am wondering if I am starting in the wrong place when I try to run my code.

Whenever I add the line WaitforInputReady (as you have in your code) to my script it just sits and spins and nothing happens.

Here is how I am trying to run this:
- I open the AS400 session A from my local computer
- I log in and move to the first screen
- I run my script from Excel or Access


How specifically are you running it when it works for you? Are you first logging into AS400? Am I even trying to run this right? I have worked with a lot of extremate macros and have never had a problem like I am having with this. I'm thinking that maybe I'm not running it right or I am missing something on my machine.
 
Upvote 0
This looks so much more impressive in Polish :)
I can imagine this can be hard for someone unaccustomed to Polish. Probably like a chinese or something :)

Whenever I add the line WaitforInputReady (as you have in your code) to my script it just sits and spins and nothing happens.
This command in fact only does that - it waits. So do not expect anything WOW from it :) Think you can experiment with time in brackets after it to see that it can take longer if you changed to seconds from miliseconds.

Here is how I am trying to run this:
- I open the AS400 session A from my local computer
- I log in and move to the first screen
- I run my script from Excel or Access
I do exactly the same so there is nothing omitted for you.


I have worked with a lot of extremate macros and have never had a problem like I am having with this.
Do you mean you have worked with AS400 macros or you rather mean Excel/Access?

I downloaded a trial version of a software called automate thinking that perhaps it would throw an error that would tell me what was wrong with our setup that would lead me in the right direction. Much to my surprise it WORKED - it opens a session, logs in, navigates to the correct screen, writes 022 successfully. The only difference is that the software opens the screen through a terminal emulator window and it doesn't touch my local session - it just goes straight to the host.
That part I do not get - first of all do not know the software but more importantly cannot really get the difference the new soft works comparing to your 'normal' way. What do you mean that it does to the terminal emulator and does not touch local session? What other session you would expect it to go if not the host/emulator?
Well, maybe my wording is incorrect as I am no-pro as stated :)

I start my A (or other) session as well, first log onto it and then run it from the main screen (in my code if GetTextRect="AMO" or "AMOV" as we have our PCCOM programm (called JBA) both central JBAC and "AMO" and local JBAP and "AMOV" on the initial screen.


It basically looks like that.
 
Upvote 0
also wanted to say I find it strange IS cannot help out, this is misery...

have you tried even to record macro, from the red button? does it work?

if your IS cannot help then maybe someone should contacted the vendor (IBM? other?) and ask them a question.
but first maybe you should try to test in on someone else's machine as you say.

mkvarious
 
Upvote 0
Yes recording a macro works fine. I have tested this on three different machines with the same result. I so appreciate your trying to help me. At least at this point I know that I am running it correctly. My point with the AutoMate application is that I am able to write to the screens through other methods using external applications. For some reason this vb just isn't working. It just has me perplexed beyond belief. I've seen others post issues like this but have not seen any resolution. I am able to see the image link you sent. Thanks
 
Upvote 0
you can read but cannot write, have not ever thought it could sound reasonably :)

not teasing you, just summarizing.

maybe you should try to look for AS400 forums on the net like Search Results - Code400 -The Support Alternative forum for instance.
I have skimmed through topics there and to me it is way too advanced and many time have no slightest idea what do they talk about but maybe you will find it useful?

what country are you, anyway?
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,327
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top