Solved

AS400 Interaction/Screen Scraping with VB6

Posted on 2004-08-25
10
530 Views
Last Modified: 2013-12-25
We have an application that uses Access97 to Pull/Modify in an FDR (AS400) system.  Currently the system perfoms a "Wait" for 5 seconds after each input to make sure that the screen refreshes and processing is completed.

We are converting the application into VB6 and I was wondering if anyone out there has an idea that will alow us to eliminate the waits.  We would like to see the VB App check to make sure that the AS400 is done processing and then move to the next step.

We are using Extra Personal Client to interface.

Mucho points to anyone that can help!  Thanks!
0
Comment
Question by:tulsajames
  • 4
  • 3
10 Comments
 

Author Comment

by:tulsajames
ID: 11913447
Come on people.  We need some help here.  :(
0
 
LVL 2

Expert Comment

by:MrPan
ID: 11943097
Where are the waits. I normally connect directly to the as400 data.

If you show some sample code maybe I can help but normall it is just a case of connecting and reading.
0
 
LVL 2

Expert Comment

by:MrPan
ID: 11943170
My code

You have posted this in the wrong section if you move this to VB instead of vbcontrols you might of got a quicker reply

'Create connection
   dim adoINVOLIB as ADODB.Connection

    Set adoINVOLIB = New ADODB.Connection

   
'Connect to lib involib as400
    With adoINVOLIB
        .ConnectionString = "Provider=IBMDA400.DataSource.1;Persist Security Info=False;User ID=USER;Data Source=AS400name"
        .ConnectionTimeout = 120
        .Open
    End With

dim rsReport as adodb.recordset

    Set rsReport = New ADODB.Recordset
     rsReport.Open "SELECT * FROM LIB.FILE",  adoINVOLIB, adOpenKeyset, adLockOptimistic

0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:tulsajames
ID: 11943195
This is a sample of code we use currently...

Please keep in mind this is NOT my code ;)  We are trying to make the system more efficient.

Public Sub PCC(AcctNum As String, PccCode As String)

'no changes necessary for 2-6-04 FDR install

'**************  Update PCC code **********************************

   Set Sess0 = GetObject("C:\Program Files\E!Pc\Sessions/Fdr.edp")

   Sess0.Screen.SendKeys ("<Home>")
   Sess0.Screen.SendKeys ("NM CL2 " & AcctNum)
   Sess0.Screen.SendKeys ("<Enter>")
   Sess0.Screen.waithostquiet (500)
   
   Dim FDRScreen
   FDRScreen = Sess0.Screen.select(6, 29, 6, 31)
   
  If PccCode = FDRScreen Then
            Exit Sub
    Else
               Sess0.Screen.moveto 6, 29
               Sess0.Screen.SendKeys (PccCode)
               Sess0.Screen.SendKeys ("<Enter>")
               Sess0.Screen.waithostquiet (500)
               
                TranComplete = Sess0.Screen.select(24, 11, 24, 44)
           
            If TranComplete = "TRANSACTION COMPLETED SUCCESSFULLY" Then
              Else
                MsgBox "FDR PCC CODE UPDATE WAS UNSUCCESSFUL"
                Exit Sub
            End If
End If

End Sub
0
 

Author Comment

by:tulsajames
ID: 11943205
As far as a direct connection is concerned, our IT department will not give us access to the FDR.  They are a bit parinoid about the whole thing...
0
 
LVL 2

Accepted Solution

by:
MrPan earned 500 total points
ID: 11943528
By looking as this code I assume that

TranComplete = ess0.Screen.select(24, 11, 24, 44)

checks for a successful completion I would try something like this

dim I as long

Do while TranComplete <> "TRANSACTION COMPLETED SUCCESSFULLY" and I <100000
       tranComplete = ess0.Screen.select(24, 11, 24, 44)
       I=I+1
Loop

The I is included to ensure that the loops does not go on for ever.

I have not used this method which I assume is screen scrapping. May be better if this was posted to the as400 section as the obects appear to be as400. But the above should mean that when the transaction is complete the program continues.

Enjoy 8)


0
 
LVL 2

Expert Comment

by:MrPan
ID: 11943553
Sorry a bit more explanation

The I is included to ensure that the loops does not go on for ever if the screen is not upated with the TRANSACTION COMPLETED SUCCESSFULLY message. Change the value in the loop until you find a value that suites. Or if there is a failure message include that in the loop and process accordingly.

I am off home now so want be able to add any more today. I will check tomorrow to see how you got on.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question