Schedule SQL on an I5

pts.
Tags:
DB2
Hi, Can anyone advise the best method of scheduling an ISQL statement to run on an I5. I need to run some update statements after hours etc. and I don't want to have to run the commands manaully each time. It has been suggested that a RUNSQL will do what I need but I am unable to find any reference to it on my system. Any help would be much appreciated. Many thanks in advance Jez

Answer Wiki

Thanks. We'll let you know when a new response is added.

1) create a source member like this :

Member Type Text
DESCRIPTION SQL DO AN UPDATE

2) edit the member, and insert the SQL. you need a ; after each statement like this :

update lib/file set field=’stuff’ where field2=’stuff’;
update lib2/file2 set field3=’stuff where field4=’stuff’;

3) either schedule the CL command, or create a CL to run multiple SQL batches using the CL command :

RUNSQLSTM SRCFILE(LIB/FILE) SRCMBR(SQLMEMBER)
COMMIT(*NONE)

I believe you can also use RPG to run SQL statements, but, that’s a lot more complicated.

hope that helps, if you have any problems, let me know. RUNSQLSTM will create a spool file that contains results from the query runs.

Kevin

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following