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

Executing a SQL using REXX


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

New User


Joined: 17 Apr 2008
Posts: 44
Location: bangalore

PostPosted: Mon Aug 16, 2010 3:50 pm
Reply with quote

Hi All,

I want to execute an SQL using REXX and to write the result in a dataset. Please help.

Thank you.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Mon Aug 16, 2010 3:53 pm
Reply with quote

For what database?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Aug 16, 2010 3:53 pm
Reply with quote

OK! get started and if You face problems someone will be glad to give suggestions
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Aug 16, 2010 3:54 pm
Reply with quote

Have you tried the fine manual first?

O.
Back to top
View user's profile Send private message
bhagyac

New User


Joined: 17 Apr 2008
Posts: 44
Location: bangalore

PostPosted: Mon Aug 16, 2010 3:57 pm
Reply with quote

Want to Know the Rexx command to execute a DB2 query.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Aug 16, 2010 3:59 pm
Reply with quote

That was easy one: ADDRESS DSNREXX EXECSQL...

O.
Back to top
View user's profile Send private message
bhagyac

New User


Joined: 17 Apr 2008
Posts: 44
Location: bangalore

PostPosted: Mon Aug 16, 2010 4:26 pm
Reply with quote

I tried using the below code..

Code:

 /* REXX */                                                       
 SQLSTMT1 = 'SELECT * FROM DBQL.EMPTAB WHERE EMPNO = '1234''   
 ADDRESS DSNREXX EXECSQL SQLSTMT1                                 


and got the error as


3 *-* ADDRESS DSNREXX EXECSQL SQLSTMT1
+++ RC(-3) +++
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Aug 16, 2010 4:29 pm
Reply with quote

and now would be a great time to take a look at the fine manual...

O.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Aug 16, 2010 5:12 pm
Reply with quote

Suggest you search "CLIST & REXX" part of the Forum on key-word "DB2" - you should be able to get some good threads on the similar topic:

www.ibmmainframes.com/viewtopic.php?t=12764&highlight=db2
www.ibmmainframes.com/viewtopic.php?t=8445&highlight=db2
www.ibmmainframes.com/viewtopic.php?t=16578&highlight=db2
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top