Page 1 of 1

Get All Data Areas in Library

Posted: Thu Jan 24, 2019 2:05 am
by jyoung
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

Re: Get All Data Areas in Library

Posted: Thu Jan 24, 2019 4:02 am
by Pablo
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

Re: Get All Data Areas in Library

Posted: Thu Jan 24, 2019 8:42 am
by MarkD
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