troubleshooting Question

Write/Read to an AS400 DataQueue in VB.NET

Avatar of matt2door
matt2door asked on
IBM System i
5 Comments1 Solution7915 ViewsLast Modified:
Here is the code I've created.  The problem I'm having is upon execution, I get and "unknown error" error message just after my message box for "about to write to dq".  Not sure what I'm missing.

Private Sub btnDQ_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDQ.Click
        ' Add a reference to IBM AS/400 Client Access Express
        ' ActiveX Object Library
        ' (C:\Program Files\IBM\Client Acccess\Shared\cwbx.dll
        On Error GoTo err_Enter
        ' Declare AS400 object
        Dim oAS400 As cwbx.AS400System
        ' Declare Data Queue object
        Dim oDTAQ As cwbx.DataQueue
        ' String objects for queue data
        Dim sWriteString As String
        Dim sReadString As String
            ' Create objects
        oAS400 = New cwbx.AS400System
        oDTAQ = New cwbx.DataQueue

        ' Define the AS400 by name - change value in quotes

        ' Supply user id and password for AS400
        ' Change values in quotes
        oAS400.UserID = "M_USER"
        oAS400.Password = "PASSWORD"

        ' Connect to Data Queue Service
        MsgBox("about to connect")
        ' Define Data Queue object - change values in quotes
        oDTAQ.LibraryName = "MATTDEV"
        oDTAQ.QueueName = "MATTDQ"

        ' Write an entry to the data queue
        sWriteString = "I wrote this string"
           MsgBox("about to write to dq")


        ' Read an entry from the data queue
               MsgBox("READ FROM DQ")
        sReadString = oDTAQ.Read(0)

        ' sReadString will now contain "I wrote this string"

        GoTo err_end

    End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros