Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1212
  • Last Modified:

AS400 Interface with VB using Dataqueue ActiveX

 I just became a Member of the site today and have a big question.
 I am in a project which asks for the  AS400(V4R4)  to synchronously exchange data with VB(ActiveX).The project asks for massive Interactive data exchange between the 2 systems.The suggection is to use Dataqueue and ActiveX.
 Please guide me step by step about the process of establishing the connection and data transfer.
 All the suggestions and ways to do are most welcome

 Thanx in advance
 Amit Bagchi

  • 2
1 Solution
Which version of Client Access are you using? You need (I think) at least 5.1 to have the Client Access ActiveX object library.

There are some examples for working with Data Queues via the ActiveX object library at:


Reading and writing from the VB side is quite straightforward... the following is a simple example of writing an entry and reading it back..

Sub DataQueueExample()

' Add a reference to IBM AS/400 Client Access Express
' ActiveX Object Library
' (C:\Program Files\IBM\Client Acccess\Shared\cwbx.dll

' 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

Set oAS400 = New cwbx.AS400System
Set 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 = "USERID"
oAS400.Password = "PASSWORD"

' Connect to Data Queue Service
oAS400.Connect (cwbcoServiceDataQueues)

' Define Data Queue object - change values in quotes
oDTAQ.libraryName = "LIBRARY"
oDTAQ.queueName = "DATAQUEUE"

' Write an entry to the data queue

sWriteString = "I wrote this string"
oDTAQ.Write (sWriteString)

' Read an entry from the data queue
sReadString = oDTAQ.Read(0)

' sReadString will now contain "I wrote this string"

End Sub

On the AS400 side, so read and write from the data queues you will need to use the QSNDDTAQ and QRCVDTAQ APIs (QSNDDTAQ to write, QRCVDTAQ to read).

A couple of good examples for these APIs can be found at:


amitbagchiAuthor Commented:
 The Client Access version we are using here is V4R4 and according to you to access Client Access ActiveX object library,I need to have V5R1.
 Now dear will V4R4 solve my purpose? I cannot ask the Client to upgrade at this point.
 Thanx a ton for the part about Reading and writing at VB end, and about sending me the URL for the required API's. But I am still at bay to find out what will get me thro with V4R4.
Please reply.
Thanx again for the response
Amit Bagchi
amitbagchiAuthor Commented:
Thanx Fletcher n sorry for the very late reply.
Your suggestion was useful.
I managed to get the Interface with ADO.
Regards & Thanx agn
Amit Bagchi
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept FletcherTheCat comment as answer

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now