For (AS/400)
I need to create a source member with multiple sentences of sql:
i.e.
update aa....
update bb....
update cc....
, and then run these source member with runsqlstm.
Is it possible? which is the character to separate between sentences?
Thanks in advance
Software/Hardware used:
ASKED:
July 24, 2008 7:42 PM
UPDATED:
October 18, 2011 10:53 PM
Hi,
This is no problem to do with RUNSQLSTM. Remember to end each statement with the semi-colon (;) and this should work fine.
Regards,
Martin Gilbert.
It’s not clear what you are looking for.
Do you have two tables? The first table seems to have a column named fieldone, and another table seems to be named file1 with a column named fieldtwo. Or is there only one table that has both columns?
If there are two tables and both tables have a column like fieldone, it seems like you want a basic subselect in your WHERE clause. But we’d need to know a little more about what columns are available.
Tom
Sorry Friends... I have only one table called FILE1 and have two fields fieldone and fieldtwo. and I run a CL with a only sentence RUNSQLSTM SRCFILE(MYLIB/QCLSRC) SRCMBR(PROGRAM1) + COMMIT(*NONE) IF the fieldone have x1,x2...x6 I Update the field fieldtwo with "changed".Then you possibly want something like this:
The IN() expression can be a list or it can be a subselect. You might use a subselect if you had the values stored in a second table. Since you only have one table and you have a small, fixed list of values, you can put the list right in the expression.
BTW, when you use the {code} button, you can type your entire question, then select just the piece that is code and then click the {code} button.
Alternatively, you can click {code} at the beginning of a piece of code and again at the end of the piece of code.
The first method puts both beginning and ending tags at the same time. The second method does one tag at a time, but it’s easy to forget to click it a second time.
Tom