MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Trapping SQLCODE in REXX

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Wed Mar 07, 2007 4:06 am    Post subject: Trapping SQLCODE in REXX Reply with quote

Hi,

Is it possible to trap the SQLCODE in REXX after a query is run thru DSNTEP2 utility?

Following are the details:

=> I am calling DSNTEP2 from REXX using queues.
Code:

    QUEUE "RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) ",
    "LIBRARY('AAAA.BBB') PARMS('CCCC')"

    QUEUE "END"
    QUEUE     


=> I am able to get the output of the query (Which I have written in the
SYSIN card) in the SYSPRINT file. I am able to find the sqlcode in the
file.

=> Is it possible to trap the SQLCODE once the query gets executed?

Please let me know if I need to provide any other information regarding the same.

Thanks,
Vivek G
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Mar 07, 2007 4:16 am    Post subject: Reply with quote

RC is set after each EXECSQL if you used DSNREXX. It is also set if you use ADDRESS TSO "RUN....
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Mar 07, 2007 4:23 am    Post subject: Reply with quote

Sorry, brain-fade (and so early in the day too!) - SQLCODE is returned in the Rexx equivalent of the SQLCA if you use DSNREXX. I guess for RC what is set is the RC from DSNTEP2 not the SQLCODE. If your output is written to a file then you can 'scrape' that to get the SQLCODE. But maybe someone else has a better solution.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Wed Mar 07, 2007 4:29 am    Post subject: Reply with quote

Nic Clouston,

I am trying to get some examples on how to use DSNREXX.

Can you provide me some example on how to execute a query using DSNREXX?

Thanks,
vivek G
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12381
Topics: 75
Location: San Jose

PostPosted: Wed Mar 07, 2007 5:54 am    Post subject: Reply with quote

vivek1983 wrote:
Nic Clouston,

I am trying to get some examples on how to use DSNREXX.

Can you provide me some example on how to execute a query using DSNREXX?

Thanks,
vivek G


Please search before posting. Search the board for "Dsnrexx" and you will find many topics

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Mar 07, 2007 6:01 am    Post subject: Reply with quote

Also, I wrote my examples by referring to the DB2 manual - Application Programming and SQL guide and in particular chapter 9
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group