How can I generate object DDL, like the CLI "show" command does?
For a SHOW TABLE the parser actually creates the CREATE TABLE based on the current definition.

But for SHOW VIEW, etc. it's retrieving the CREATE from dbc.TablesV.RequestText. If the source code is larger than 12.5 KB RequestTxtOverFlow is set and the remainder is found in one or more 32 KB chunks in dbc.TextTbl.

For SHOW PROCEDURE it's different, this returns the internally stored sorce code (unless the SP is created with the NOSPL option), there's no way to access this info using a Select.