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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sporadic failures in Attachmate Scraping Web App 2

Status
Not open for further replies.

decline1822

Programmer
Dec 11, 2006
7
US
Hi everyone. I am new to these forums and appreciate any help.

I am working on a web application which leverages the Extra.System object to pull some data from the mainframe, perform several calculations, and present some data to the user. The code is written entirely in HTML and JavaScript.

The problem I am having is that; occasionally (maybe 1 in 3 lookups), the GetString method does not return the data it should.

I suspect the issue is related to the Wait function I have implemented. After each SendKeys a WaitHostQuiet is called with an interval of 5.

Generally speaking, what intervals do you usually use for WaitHostQuiet?

Has anyone else tried using the Extra.System object through javascript? If so, did you experience similar issues?


Thanks again!
 
There is one other thing I should mention. I am doing this over a VPN Tunnel, so I'm not sure if that can impact the process.

 
WaitHostQuiet always has a chance to fail if the system doesn't return in time. It's better to use the OIA object or Wait for a string on the screen.

I use:
Do while Sess0.Screen.OIA.Xstatus <> 0
doevents
Loop

If you really want to be sure you're in the right place, you can put a WaitForString after the loop.

calculus
 
Thanks calculus for the quick reply!

Can you recommend a link for the OIA object? I am unfamiliar with that.

I will try doing a WaitForString after each "<enter>" that I send to the emulator.

Thanks again, you rock!
 
I just pulled up the OIA object in Object Browser... looks useful.

XStatus returns the status of the XCLOCK... is that the value shown by the little clock at the bottom of the Emulator window? What is the significance of that value?

Sorry for the n00bish questions. Thanks again.
 
Yes, the OIA object will tell you what "busy" state the system is in. I typically just use it as noted above to tell me when the system is no longer waiting for anything -- XStatus = 0.

calculus
 
Calculus, before reading this thread, I was using Sess.Screen.WaitHostQuiet(g_HostSettleTime) along with the Sleep API and both resulted in inconsistent and slow results. Thank you!
 
Welcome.

By the way, I typically use a function called Wait. It optionally lets you give a string to wait for. Othersize it will implement the action you give it and wait for the OIA to go away.

Code:
Private Sub Wait(Optional Action, Optional WaitForString)
With Sess0.Screen

If IsMissing(Action) Then Action = "<Enter>"

If Left(Trim(Action), 1) <> "<" Then Action = "<" & Trim(Action)
If Right(Trim(Action), 1) <> ">" Then Action = Trim(Action) & ">"

.SendKeys Action
Do While .OIA.XStatus <> 0
    DoEvents
Loop
If .GetString(24, 11, 14) = "REASONABLENESS" Then Wait "Enter"

If Not IsMissing(WaitForString) Then .WaitForString WaitForString

End With
End Sub

calculus
 
Using calc's suggestions, we have successfully implemented an automation tool which allowed us to meet a critical year-end objective in 2006 and deliver better customer service as a result of the improved process.

The tool has been working great and will continue that way until we can replace the screen scraping with a more robust solution. Thanks again calculus, I don't think I could have done it without your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top