2

Quite new to this AS400. I've tried this code and it works to list all the files:

SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE 
FROM QSYS2.SYSTABLES 
WHERE TABLE_SCHEMA = 'QGPL' 
ORDER BY TABLE_NAME

How do I list all the dataq inside the QGPL?

3
  • Hello and welcome! Data Queues aren't files, and it's another serial of functions that are used to manage them or retrieve their content. Commented Aug 27 at 4:56
  • Okay. So I can't list what dataq. Is there anyway to see/extract the characters from the dataq through sql query? Or must be a python job to do this? Commented Aug 27 at 5:27
  • It's far from me now, but I guess I would call QRCVDTAQ (or QMHRDQM?) from a program to retrieve a data queue content. Commented Aug 27 at 5:34

2 Answers 2

1

What version of IBM i are your running? IBM has added "SQL Services" around many OS APIs .. including QSYS2.DATA_QUEUE_ENTRIES()

SELECT * FROM TABLE(QSYS2.DATA_QUEUE_ENTRIES(
                                             DATA_QUEUE => 'DQ1', 
                                             DATA_QUEUE_LIBRARY => 'TESTLIB'))
  ORDER BY ORDINAL_POSITION

Should be available starting at 7.4 w/SF99704 Level 10 or higher

If on out of date version, you could always built your own UDTF that calls the system API.

EDIT

On second look, it appears you are just wanting a list of data queues...
Try OBJECT_STATISTICS table function

SELECT * FROM TABLE (QSYS2.OBJECT_STATISTICS('QGPL','DTAQ','*ALLSIMPLE')) X
Sign up to request clarification or add additional context in comments.

2 Comments

I am amazed. It works
Why are you amazed?
1

IBM i provides a set of SQL functions for working with DTAQ. They are located in the QSYS2 library.

To obtain a list of DTAQs with all their properties you can use DATA_QUEUE_INFO view:

SELECT * FROM QSYS2.DATA_QUEUE_INFO

There are also DATA_QUEUE_ENTRIES, CLEAR_DATA_QUEUE, SEND_DATA_QUEUE and RECEIVE_DATA_QUEUE

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.