Get All Data Areas in Library

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jyoung
Posts: 652
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Get All Data Areas in Library

Post by jyoung » Thu Jan 24, 2019 2:05 am

Is there a way to get all the data areas in a library? Something like select * from ????? where DTALIB = 'MYLIB'

I am wanting to add a simple "configuration" editor in our VLF-ONE Admin application. We have a library with some data areas that we keeps some config settings and I want to be able to change those on the fly without having to go into a 5250 screen to do so. I can take care of the reading and writing, but I don't know how to get all of them.

I could just hard code the data areas in a list, but would prefer to make it a bit more dynamic.

Thanks,
Joe

Pablo
Posts: 43
Joined: Wed Dec 02, 2015 10:35 am

Re: Get All Data Areas in Library

Post by Pablo » Thu Jan 24, 2019 4:02 am

Hi Joe,

You could call a CL in your server module that does something like this ... you'd change the OBJ and OUTFILE to suit your needs:

DSPOBJD OBJ(*ALL) OBJTYPE(*DTAARA) OUTPUT(*OUTFILE) OUTFILE(PABLIB/PABTEST)

Then turn the OUTFILE file into a flat file, again you may want to change some parms like FLDDLM, RCDDLM ...

CPYTOIMPF FROMFILE(PABLIB/PABTEST) TOSTMF('/tmp/pabtest.txt') STMFCCSID(*STDASCII) STMFCODPAG(*STMF) RCDDLM(*CRLF) FLDDLM(*TAB)

/tmp/pabtest.txt is now a TAB delimited ascii file that you can easily transform into a working list using TRANSFORM_FILE and then process in a simple selectlist loop.

Hope this helps.
Pablo

MarkD
Posts: 625
Joined: Wed Dec 02, 2015 9:56 am

Re: Get All Data Areas in Library

Post by MarkD » Thu Jan 24, 2019 8:42 am

If you are using 7.2 (or later) of the IBM i operating system then SQL can do a lot of these type of things as well.

For example - https://www.ibm.com/support/knowledgece ... ctstat.htm

Post Reply