I'm confused. You're wanting to programmatically generate the sql for what? The view? That ability is already there. Use iSeries Navigator. Open the connection to your iSeries, Expand Databases, Expand Schemas. If you library isn't listed as a schema to view, then right click on the Schemas, Select Schemas to view. Expand your Schema. Click on VIEW (or functions, procedures, tables, etc). You will then see a list of views that have been created in your schema(library).
Right click on the view and select Generate SQL. In the new window, there's an option to write to file. Select it! Then select the file name you want to write to, this would be your physical source file name (i.e. QSQLSRC). Enter the partition, this would be the member name. Click on the format tab. You can change the naming conventions here if you need to. Then click on Generate. You will now have generated source of the view you just selected.
You can do this with functions, procedures, tables, indexes, etc.
You could also choose to build your stuff through iSeries Navigator and use the steps I just showed you to save the source elsewhere. We do this for change management.
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of James Lampert
Sent: Friday, April 22, 2011 3:06 PM
To: Midrange Systems Technical Discussion
Subject: Re: Another SQL question: This time with VIEWs
If you perform a "label on" to change the label on one column it will not
change the labels on any other columns. Is that selective enough? You
could do them one at a time, if that's what you desire.
Silly me! At first, I thought LABEL_ON was a clause on the CREATE VIEW.
And I've got it working very nicely now.
Next step is to write something to generate the SQL programmatically.
BTW: Is there a way to INCLUDE one source member in another, in RUNSQLSTM?
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
Notice from Bob Evans Farms, Inc: This e-mail message, including any attachments, may contain confidential information that is intended only for the person or entity to which it is addressed. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.