ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

get info from AS400 iSeries through vb6?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • get info from AS400 iSeries through vb6?

    Hi,

    We have iSeries and all users have client access express installed.

    Here is what we want to do, create an application in vb and let say have 10 text box in the screen and let the user input 10 different part#, then when hit the submit button. somehow the application pass the inputted part# to the as400 and evoke a program on as400 to get the stock of the part#, once the result is ready , it send the result back to the PC and refresh the screen.

    Is that possible? any tools or any method can do something like this? I'm thinking send / receive a XML file , or I don't need to do this.

    Any suggestions are welcome

    Thank you very much !

  • #2
    Re: get info from AS400 iSeries through vb6?

    A Fast Path to AS/400 Client/Server Using AS/400 OLE DB Support

    For .NET:
    Integrating DB2 Universal Database for iSeries with Microsoft ADO .NET
    "Time passes, but sometimes it beats the <crap> out of you as it goes."

    Comment


    • #3
      Re: get info from AS400 iSeries through vb6?

      Thanks and I did read those IBM Redbook, but those book don't have any example. Can I get some simple example on how to send/recieve dataq from vb6?

      Thanks!

      Comment


      • #4
        Re: get info from AS400 iSeries through vb6?

        This is probably a dumb question, but this sounds like something that should probably be a green screen application. Why do you need the GUI?
        Jonas Temple
        Got FROG?
        Got Tadpole? No, because it's not done yet! Stay tuned....

        01010111 01100001 01110011 01110011 01110101 01110000 00100000 01100100 01101111 01100111 00111111

        Comment


        • #5
          Re: get info from AS400 iSeries through vb6?

          Why use a dtaq when you can use ADO over the iSeries Access OLE DB Provider to query the database tables directly?
          "Time passes, but sometimes it beats the <crap> out of you as it goes."

          Comment


          • #6
            Re: get info from AS400 iSeries through vb6?

            hi mapper, here is a real simple example;

            This reads the entire file, but you can build your select ,,,, from ,,, where ,,,, to better suit your needs.



            PHP Code:
            Private Sub cmdLoadIseries_Click()
            ' This requries that there be a DSN setup on the user's box.  Make this a system DSN
            ' called "MYAS400"
            and on the "Packages(S)" tabun-check the "Enable extended Dynamic support"


            Dim objConn As New ADODB.ConnectionobjRs As New ADODB.Recordset
            Dim ObjCommand 
            As New ADODB.Command
            Dim X 
            As LongAs Long
            Dim UserId
            PassWordLibrary As String
            Dim ThisInteger 
            As Integer
            Dim BadField
            ThisCountA As String
            Dim ThisCount 
            As Long

            On Error 
            GoTo ErrorHandler    ' Enable error handler


            UserId = UCase(txtUser.Text)
            PassWord = UCase(txtPassword.Text)
            Library = UCase(txtLibrary.Text)

            If Library = "" Then
                msg = "The library is blank WTF!!!"
                MsgBox msg, vbOKOnly
                Exit Sub
            End If

            frmMain.MousePointer = vbHourglass
            ThisCount = 0
            objConn.ConnectionString = "DSN=MYAS400;DRIVER=Client Access ODBC Driver (32-bit); " & _
                                       "SYSTEM = 205.205.205.1; UID = " & UserId & _
                                       ";PWD = " & PassWord
            objConn.Open

            '
            Now get the records
            objRs
            .Open "SELECT IVNDP# FROM " Library ".INVMST"objConnadOpenDynamicadLockOptimistic
            'Loop until we've hit the EOF (end of file)
            Do 
            Until objRs.EOF True
               
                ThisCount 
            ThisCount 1
               
            'Move to the next record (important!!)
               objRs.MoveNext
            Loop
            '
            Close the Recordset object
            objRs
            .Close

            'Delete the Recordset Object
            Set objRs = Nothing


            '
            Close the Connection object
            objConn
            .Close

            'Delete the Connection Object
            Set objConn = Nothing
                
               
               
                '
            objRs.Fields(11) = Cells(RowCount1).Value 'Shop Field
                
               
            frmMain.MousePointer = 0
            msg = "downloaded " & CStr(ThisCount) & " number of records from Invmst."
            MsgBox msg, vbOKOnly

            Exit Sub '
            get out before the Error Handler kicks in

            '//////////////////////////////////////////////////////////
            ErrorHandler:
                Select Case Err.Number
                    Case -2147217843
                        msg = "You must enter you User ID and Password: " & Err.Number _
                        & " Or your user ID and Password are not correct."
                        MsgBox msg, vbOKOnly
                    Case 13
                        msg = "You have text data in a numeric field (" & BadField & "). Fix and re-Upload"
                        MsgBox msg, vbOKOnly

                    Case Else
                        msg = "Error is " & Err.numer & " /  " & Err.Description
                        MsgBox msg, vbOKOnly
                End Select

            End Sub 
            Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

            Comment


            • #7
              Re: get info from AS400 iSeries through vb6?

              Originally posted by DeadManWalks View Post
              hi mapper, here is a real simple example;

              This reads the entire file, but you can build your select ,,,, from ,,, where ,,,, to better suit your needs.



              PHP Code:
              Private Sub cmdLoadIseries_Click()
              ' This requries that there be a DSN setup on the user's box.  Make this a system DSN
              ' called "MYAS400"
              and on the "Packages(S)" tabun-check the "Enable extended Dynamic support"


              Dim objConn As New ADODB.ConnectionobjRs As New ADODB.Recordset
              Dim ObjCommand 
              As New ADODB.Command
              Dim X 
              As LongAs Long
              Dim UserId
              PassWordLibrary As String
              Dim ThisInteger 
              As Integer
              Dim BadField
              ThisCountA As String
              Dim ThisCount 
              As Long

              On Error 
              GoTo ErrorHandler    ' Enable error handler


              UserId = UCase(txtUser.Text)
              PassWord = UCase(txtPassword.Text)
              Library = UCase(txtLibrary.Text)

              If Library = "" Then
                  msg = "The library is blank WTF!!!"
                  MsgBox msg, vbOKOnly
                  Exit Sub
              End If

              frmMain.MousePointer = vbHourglass
              ThisCount = 0
              objConn.ConnectionString = "DSN=MYAS400;DRIVER=Client Access ODBC Driver (32-bit); " & _
                                         "SYSTEM = 205.205.205.1; UID = " & UserId & _
                                         ";PWD = " & PassWord
              objConn.Open

              '
              Now get the records
              objRs
              .Open "SELECT IVNDP# FROM " Library ".INVMST"objConnadOpenDynamicadLockOptimistic
              'Loop until we've hit the EOF (end of file)
              Do 
              Until objRs.EOF True
                 
                  ThisCount 
              ThisCount 1
                 
              'Move to the next record (important!!)
                 objRs.MoveNext
              Loop
              '
              Close the Recordset object
              objRs
              .Close

              'Delete the Recordset Object
              Set objRs = Nothing


              '
              Close the Connection object
              objConn
              .Close

              'Delete the Connection Object
              Set objConn = Nothing
                  
                 
                 
                  '
              objRs.Fields(11) = Cells(RowCount1).Value 'Shop Field
                  
                 
              frmMain.MousePointer = 0
              msg = "downloaded " & CStr(ThisCount) & " number of records from Invmst."
              MsgBox msg, vbOKOnly

              Exit Sub '
              get out before the Error Handler kicks in

              '//////////////////////////////////////////////////////////
              ErrorHandler:
                  Select Case Err.Number
                      Case -2147217843
                          msg = "You must enter you User ID and Password: " & Err.Number _
                          & " Or your user ID and Password are not correct."
                          MsgBox msg, vbOKOnly
                      Case 13
                          msg = "You have text data in a numeric field (" & BadField & "). Fix and re-Upload"
                          MsgBox msg, vbOKOnly

                      Case Else
                          msg = "Error is " & Err.numer & " /  " & Err.Description
                          MsgBox msg, vbOKOnly
                  End Select

              End Sub 

              Thanks, will try it, but just wonder the performance / speeds by using the OLEDB , SQL statement o access the data directly?

              Comment


              • #8
                Re: get info from AS400 iSeries through vb6?

                The performance is very solid, provided you have good logicals over the files. It the process takes time, you should look to see if it is building indexes on the fly. If so , create them and then you are good to go.

                hth
                Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

                Comment


                • #9
                  Re: get info from AS400 iSeries through vb6?

                  Originally posted by DeadManWalks View Post
                  The performance is very solid, provided you have good logicals over the files. It the process takes time, you should look to see if it is building indexes on the fly. If so , create them and then you are good to go.

                  hth
                  Hi,

                  It works, but a bit slow, just query on a single table and extract two columns with the WHERE clause, when the command button clicked, it takes about 6 seconds.

                  Is that because It need time to open the connection? may be I should open the connection when the first form loaded.

                  Any suggestion?

                  Comment


                  • #10
                    Re: get info from AS400 iSeries through vb6?

                    Having the connection opened at program start is good.

                    Take your SQl and run in on the ISeries and see how long that takes. You could debug this job and see what the system is selecting as the record access method.
                    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

                    Comment


                    • #11
                      Re: get info from AS400 iSeries through vb6?

                      Hi,

                      Just installed the iSerier Client access and it shows something call "iSeries ADO Wizard" in the VB6 IDE. I tried and it can link as400 table and it create a class call DA400Links.cls file, but I don't know it retreive the record / access the table a lot of faster than the standard OLEDB.

                      But just don't understand how to put the SQL statement inside the codes. or CLASS definition.


                      Any one try that and have any experiement on it?

                      Thanks!

                      Comment


                      • #12
                        Re: get info from AS400 iSeries through vb6?

                        I also found there are some third-party tool out there to replace the standard OLEDB driver

                        like Hit VB /OLEDB and EASYCOM VB OLEDB

                        are there anyone trying those products? just wonder what is the different between those driver and the one comes with client access.

                        Thanks!

                        Comment

                        Working...
                        X