×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Personally, I'd just you iNav to right click on an object and Generate SQL.

IBM provides the API so that other tools, for instance my CMS system, has
access. But I don't see any advantage to manually calling the API vs.
having a UI of some sort call it.

Charles


On Mon, Oct 19, 2015 at 12:15 PM, Justin Dearing <zippy1981@xxxxxxxxx>
wrote:

Ok new thread now that I've had some time to digest.

On Thu, Oct 15, 2015 at 3:24 PM John Yeung <gallium.arsenide@xxxxxxxxx>
wrote:


- Go through a STRPDM tutorial for SQL just to get familar with the
mechanics.
- Do the next DB schema design project with SEU and RUNSQLSTM

Not sure how PDM relates to SQL, or how SEU relates to RUNSQLSTM; but
yeah, I guess if you're just exploring and you don't know a lick of
RPG or CL then sure, knock yourself out.


The particular RPG programmer I deal with at the moment stores DDL SQL in
source members in a source file called QSQLSRC. The file has the same name
as the table. He edits the file with SEU and executes with RUNSQLSTMT. I
assumed this was a common practice, especially since QSYS2.GENERATE_SQL
lets you create the source member after the fact. So am I just learning a
pattern that this particular client uses, or am I learning a pattern that
I'll find elsewhere as I deal with different RPG programmers from different
shops?

Second question, this particular RPG programmer uses TXT source members to
store SQL. Would SQLC or some other format be better? I can't find the
developer works page that tells me what all the source member types are
for.

Thirdly, I've been trying to generate source members like this:

CALL QSYS2.GENERATE_SQL(
'TBL', 'TBLLIB', 'TABLE',
'QSQLSRC', 'TBLLIB', 'TBLSOURCEMBR',
STATEMENT_FORMATTING_OPTION => 1,
REPLACE_OPTION => 1,
CREATE_OR_REPLACE_OPTION => 1,
CONSTRAINT_OPTION => 1,
DROP_OPTION => 1,
NAMING_OPTION => 'SQL',
QUALIFIED_NAME_OPTION => 0
);

I do that in SQL Workbench, and if I mess up a parameter, like specify a
table that doesn't exist, I don't get a useful error message. The helpful
error message is in the the joblog, that I get with SELECT * FROM
table(QSYS2.JOBLOG_INFO('*')) a; Is there a way to get the ORDINAL_POSITION
or MESSAGE_ID of a failed sql statement so I can look up the message that
way? All I get back now is "[SQL0443] QSQGNDDL ERROR [SQL State=58004, DB
Errorcode=-443]". I guess I could get the timestamp as a variable before I
send the statement and then put that in the WHERE clause.
--
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,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.