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 

Dynamic sql select query

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
syam
Beginner


Joined: 14 May 2006
Posts: 22
Topics: 7
Location: INDIA

PostPosted: Tue Dec 26, 2006 5:15 am    Post subject: Dynamic sql select query Reply with quote

Hi,
I want to use Dynamic Sql Select Query in a cobol , DB2, CICS program, Please let me know the process and compiler options and any other issues to be taken care of.I want a practical programmable solution

Thanks
_________________
S Y A M
ONE CAN SMILE AND SMILE AND BE A VILLIAN
Back to top
View user's profile Send private message Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Dec 26, 2006 5:03 pm    Post subject: Reply with quote

syam,


Check this link which explains every thing about dynamic sql along with examples here

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNAPH11/6.1?DT=20010710165542

Hope this helps...

Cheers

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


Joined: 14 May 2006
Posts: 22
Topics: 7
Location: INDIA

PostPosted: Wed Dec 27, 2006 2:11 am    Post subject: Reply with quote

Kolusu,

Thanks for the info.After fetching the rows , the rows are moved into SQLDA, How to retrieve these values from SQLDA.
_________________
S Y A M
ONE CAN SMILE AND SMILE AND BE A VILLIAN
Back to top
View user's profile Send private message Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Dec 27, 2006 3:57 pm    Post subject: Reply with quote

Quote:

After fetching the rows , the rows are moved into SQLDA, How to retrieve these values from SQLDA.

syam,

Where did you get that information? Did you even bother reading what it is in the above link?

Read the link once again

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


Joined: 14 May 2006
Posts: 22
Topics: 7
Location: INDIA

PostPosted: Thu Dec 28, 2006 9:44 am    Post subject: Reply with quote

Kolusu,
Thank you now i got the things. Any how i made the design changes so that the progarm could accomadate for fixed list selct. I have browsed the ibm link http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/sqlp/rbafyfixed.htm . He gave the below example
MOVE 'SELECT EMPNO, LASTNAME FROM CORPDATA.EMPLOYEE WHERE EMPNO>?'
TO DSTRING.
EXEC SQL
PREPARE S2 FROM :DSTRING END-EXEC.

EXEC SQL
DECLARE C2 CURSOR FOR S2 END-EXEC.

EXEC SQL
OPEN C2 USING :EMP END-EXEC.

PERFORM FETCH-ROW UNTIL SQLCODE NOT=0.

EXEC SQL
CLOSE C2 END-EXEC.
STOP-RUN.
FETCH-ROW.
EXEC SQL
FETCH C2 INTO :EMP, :EMPNAME END-EXEC.

Now what should be the Picture clause of S2. Awaiting for a quick reply.
_________________
S Y A M
ONE CAN SMILE AND SMILE AND BE A VILLIAN
Back to top
View user's profile Send private message Visit poster's website
syam
Beginner


Joined: 14 May 2006
Posts: 22
Topics: 7
Location: INDIA

PostPosted: Thu Dec 28, 2006 10:17 am    Post subject: Reply with quote

Kolusu,
Execution is successful without declaring S2, Thank you very much for the efforts put up.
_________________
S Y A M
ONE CAN SMILE AND SMILE AND BE A VILLIAN
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database 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