Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
On this forum and at a training session I went to, some folks go and "save" a copy of the sql commands to create a table in a source (rather than simply going in inav and regenerating it).
What would be "nice" is to have a tool that would generate a single file (and its indexes (very important)) or a whole schema (library) of all the tables.
like getmesql (mytable/myschema) which would return the create and all field definitions along with any and all "LF's" (indexes).
or you could say getmesql(*all/myschema) which would return all tables and indexes.
Personally I don't store them, but at times I do blow away a table and rebuild it so I have to first go get the sql from inave and get the indexes.
The RTVSQLSRC command I wrote years ago does that, but only for an indiviual file. You could do a DSPDBR over the table in question and then issue RTVSQLSRC over each corresponding object.
I think the source for RTVSQLSRC is on this site (just search for it).
It just uses the corresponding IBM i API under the covers anyway, so you could write your own.
when you said years ago, I did a google search (as didn't find it here), and saw a forum posts from way back in like 2003. Of course some of the threads questioned why you would use sql instead of dds to set up a file, which to me, in this day and age, it makes no sense to use dds, only to use sql. But that is probably a hot topic.
chris