View previous topic :: View next topic
|
Author |
Message |
nabarundas
New User
Joined: 21 Jun 2007 Posts: 28 Location: pune
|
|
|
|
Hi,
I am executing the following SQL queries through JCL by using DSNTEP2
Code: |
.
.
//SYSIN DD *
--#SET TERMINATOR ;
Insert into <tablename1> values <values1);
Insert into <tablename2> values <values2);
/* |
Now I want to execute the second query depending on the success of the first query. How can I do it?
Regards,
Nabarun |
|
Back to top |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
Not quite sure how to check the SQLCODE but I have one Idea if it is only two queries.
Put two inserts in two JCL steps using DSNTEP2. If step1 is sucess then execute step2 using condition codes. This way you dont need to be worried about ROLLBACK. If step1 fails it would have been already Rolled back.
Does that work .? I would do this rather than cracking DSNTEP2 code. Gues DSNTEP2 is written in Assembler or COBOL?. |
|
Back to top |
|
|
nabarundas
New User
Joined: 21 Jun 2007 Posts: 28 Location: pune
|
|
|
|
Thanks for your suggestion Vini.
But I want to check the return code because later few more queries might need to be included. So writing DSNTEP2 steps will not be convenient for me.
If some one knows how to check the return code then it will be helpful for me otherwise I have to go for COBOL program and do the LUW.
What do you suggest?
Regards,
Nabarun |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you use a COBOL program you will have far more flexability and control of the process. Your process could support more than only simple inserts.
You could also incorporate an audit trail of what was done for when there are questions. Makes me breathe easier to have a record of what database maintenance was done "outside" the system and may also satisfy some auditors (if you deal with them - them see red flags when spontaneous updates are done to database content). |
|
Back to top |
|
|
|