Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Application sending commands to AS400 client

Status
Not open for further replies.

mot98

MIS
Jan 25, 2002
647
CA
Hi All,

I have a VB application that connects to the IBM I-Series client and
sends some keystrokes.


I am connecting using PCOMM with the following code:

Code:
Dim autECLSession As AutConnList 
Dim autECLPS As AutPS 
varSerial = frmMain.txtSerial1 
Set autECLConnList = CreateObject("pcomm.autECLConnlist") 
Set autECLPS = CreateObject("pcomm.autECLPS") 


autECLConnList.Refresh 


'Connecting to Session A 


autECLPS.SetConnectionByName ("A") 


autECLPS.SendKeys "[FLDEXT]" 
autECLPS.SendKeys "1" & "[ENTER]" 
autECLPS.SendKeys "1" & "[ENTER]" 
autECLPS.SendKeys "STK" & "[ENTER]" 
autECLPS.SendKeys varSerial & "[ENTER]"

This works fine....however, I need to put some error checking in place
to ensure that the Emulator window is not in an error state, and is
ready to accept data.


Is there a way to check to see if there is an error on the screen??




mot98
[cheers]
"Is it friday yet?"
 
Mot
error trap for Err().Number -2147352567 if there is an error in the OIA then this error will throw.

autECLPS.SendKeys "[reset]" will remove the error.

For more information check my post at

this has my fully developed HACL mod

HTH

Scoty

Learn from others' mistakes. You could not live long enough to make them all yourself
-- Hyman George Rickover (1900-86)
 
Back in to 2002 i devloped a system that used 'WinHllApi32.dll' (Google it) the standard at the time for screen scraping an terminal screen application at the company i was working for, also ment my application would work on other terminal applications not just IBM's Pcomm. Not sure if HACL is new or just IBM's? But just thought i would give another way that it can be done.

Regards,
Darren
 
An unreliable way is to use: (it many times doesn't wait properly)
Code:
  If autECLPS.Ready Then autECLPS.SendKeys "[FLDEXT]"

If the server will be updating the cursor position as well, you may want to use:
Code:
  autECLPS.WaitForCursor (row,column,max wait time in ms)

A more reliable way to verify it is available is to connect to the OIA (as well as WaitForCursor). Add:
Code:
  Dim autECLOIA as autOIA

  Set autECLOIA = CreateObject("pcomm.autECLOIA")
After each "SendKey" that involves waiting for the server to respond, add:
Code:
  autECLOIA.WaitForAppAvailable
After each other "SendKey" that involves waiting for the local session to complete writing to the screen, add:
Code:
  autECLOIA.WaitForInputReady
 
An odd question/suggestion: does your application actually enter OS/400 commands, or is it screen-scraping for data entry/retrieval? If the latter is the case, I'd like to suggest ODBC.

Once upon a time, I was involved in creating a VB EHLLAPI app that scraped screens on a local '400 and a remote mainframe. Each update process the user ran took almost five minutes to complete because of the Waits we had to put in place, (the older '400 model - an old B1-something - probably had something to do with the delay, too). The user had time to hit the <Enter> key, then "prepare" the next transaction.

I recently converted the application to ODBC, (iSeries Access), for the AS/400 portion of the updates - and cut the processing time to 30 seconds per transaction, (including the operator's data entry time)! Now the users complain that they have to prepare a stack of cards before they begin processing.

Just an idea, that I hope can help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top