ActiveX AS/400 Objects - DataQ


 

Name Type Description
AttrAuthority 1 Sets or returns security authority level attribute.
AttrDescription String Sets or returns text description attribute.
AttrForceToStorage Boolean Controls force to auxiliary storage attribute.
AttrKeySize Integer Defines length of key in bytes attribure.
AttrMaxRecordLength Long Defines length of maximum record in bytes attribute.
AttrOrder 2 Sets or returns FIFO, LIFO or keyed sequence attribute.
AttrSenderID Boolean Controls sender ID existence attribute.
AutoMessages Boolean Set True to halt and display error messages.
DataConvert Boolean Controls ASCII/EBCDIC data conversion. Defaults to True.
DataConvertKey Boolean Controls ASCII/EBCDIC key conversion. Defaults to True.
DataKey String Defines key of record.
DataSearchOrder 3 Defines record search order of keyed DataQ.
LibraryName String Name of AS/400 library. Read-only if open
QueueName String Name of AS/400 data queue. Read-only if open
SystemName String Name of AS/400 system. Read-only if open
Tag String User defined identification in logs and messages.
TimedOut Boolean Is set to True after WaitTime has expired during ReadQ or PeekQ. Set to False during OpenQ.
WaitTime Long Number of seconds to wait before returning from ReadQ or PeekQ method if no records exist. WaitTime value ranges from 0 to 99999 seconds, where zero will wait indefinitely. See PeekQ and ReadQ methods.

 

1 AS/400 object authority dqAUTHORITY Enum autAll = 0, autExclude = 1, autChange = 2, autUse = 3, autLibCreate= 4

2 Data queue sequence order dqSEQORDER Enum seqLIFO = 0, seqFIFO = 1, seqKeyed = 2

3 Data queue search order dqSEARCHORDER Enum srcNone = 0, srcEqual = 1, srcNotEqual = 2, srcGTorEqual = 3, srcGreater = 4, srcLTorEqual = 5, srcLess = 6

 

  • Contains read-only properties:

 

Name Type Description
DataKeyReturned String Value of key contained within the most recent record returned via ReadQ or PeekQ.
DataSenderInfo String Value of Sender ID contained within the most recent record returned via ReadQ or PeekQ.
Message String Most recent diagnostic message generated.
Opened Boolean Returns True if currently opened. See OpenQ.
RC Long Most recent CA/400 dll response code.
ReadTimedOut Boolean Returns True if most recent ReadQ or PeekQ resulted in a 'time-out'. See WaitTime.

 

 

  • Contains methods returning a result:

 

Name Type Description
ClearQ Long Returns RC after clearing data queue records based on optional key. If data queue is non-keyed then all records are cleared, else DataKey controls records cleared.
CloseQ Long Returns RC after closing connection. OpenQ must be performed before CloseQ.
CreateQ Long Returns RC after creating data queue. Attribute properties must be set before CreateQ for desired results.
DeleteQ Long Returns RC after deleting data queue.
OpenQ Long Returns RC after opening connection with data queue. Use CloseQ to end connection. If OpenQ is not used before PeekQ, ReadQ or WriteQ methods, OpenQ is performed automatically.
PeekQ String Returns contents of a data queue record based on optional key retaining original entry on data queue. If key is not passed then DataKey is used. If non-keyed data queue is opened then key is disregarded. Windows operating system is halted until record is retrieved or WaitTime expires.
ReadQ String Returns contents of a data queue record based on optional key removing entry from data queue. If key is not passed then DataKey is used. If non-keyed data queue is opened then key is disregarded. Windows operating system is halted until record is retrieved or WaitTime expires.
WriteQ Long Returns RC after writing record of required text parameter. Optional key parameter sets DataKey. If key is not passed then DataKey is used.

 

  • VB, VBA DataQ example (dqSEQORDER = seqKeyed):

 

Dim oDQ As ActiveX_AS400.DataQ

Dim sData As String

Set oDQ = new ActiveX_AS400.DataQ

 

‘ Create a AS/400 data queue

oDQ.LibraryName = "QGPL"

oDQ.QueueName = "TestDQ"

oDQ.AttrMaxRecordLength = 128

oDQ.AttrKeySize = 10

oDQ.AttrMaxRecordLength = 128

oDQ.AttrOrder = 2 ‘seqKeyed

oDQ.AttrSenderID = True

If not oDQ.CreateQ = 0 Then MsgBox oDQ.Message

 

‘Put data into the AS/400 data queue

sData = "Testing 1.2.3.4"

oDQ.DataKey = "Key 1.2"

If not oDQ.WriteQ(sData) = 0 Then MsgBox oDQ.Message

 

‘Read data from the AS/400 data queue

oDQ.WaitTime = 1 ‘second

oDQ.DataSearchOrder = 3 ‘srcGTorEqual

sData = oDQ.PeekQ("Key")

 

‘Show results

MsgBox "PeekQ.Data:" & sData

MsgBox "ReadQ.Data:" & oDQ.ReadQ("Key")

MsgBox "DataKeyReturned:" & oDQ.DataKeyReturned

MsgBox "DataSenderID:" & oDQ.DataSenderID

 

‘Housekeeping

If not oDQ.CloseQ = 0 Then MsgBox oDQ.Message

If not oDQ.DeleteQ = 0 Then MsgBox oDQ.Message

Set oDQ = Nothing

2003 - Chouinard & Myhre, Inc.