IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

checking the return code in DSNTEP2


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nabarundas

New User


Joined: 21 Jun 2007
Posts: 28
Location: pune

PostPosted: Wed Aug 06, 2008 5:18 pm
Reply with quote

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
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Wed Aug 06, 2008 7:54 pm
Reply with quote

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 icon_smile.gif.? I would do this rather than cracking DSNTEP2 code. Gues DSNTEP2 is written in Assembler or COBOL?.
Back to top
View user's profile Send private message
nabarundas

New User


Joined: 21 Jun 2007
Posts: 28
Location: pune

PostPosted: Thu Aug 07, 2008 10:12 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Aug 07, 2008 7:32 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
Search our Forums:

Back to Top