AS400 / DB2 Generate DDL from views and spool files

gnivkor used Ask the Experts™
Hello Experts

I am trying to view the DDL of views on an as400, i need to know what tables certain data is coming from on reports.

I also would like to know where the data on generated spool files is being pulled from. Is there any way to achieve either of the 2 or both of these request ?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
you can use the table sysviewdep to see which view depends on which tables (or other views)
Software Developer / Database Administrator
For your first question, multiple methods exist to see the source of a view. Personally, I find it easiest to use the GUI (System i Navigator). Just navigate to the view in which you're interested (by expanding the "Database" tab), right-click on it, and select "Generate SQL".

Alternately, from a green-screen, you can simply do a DspFd on the view. The resulting screen shows the associated "Create View" statement which should give you all the information you need.

Your second question is a little more challenging. The spool file was most likely generated by a program, so you’ll have to inspect that program to determine the logic inside of it. To my knowledge, there’s no easy way to determine what program generated a specific spool file, but it’s usually something you can determine by asking around and looking at job-logs.



thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial