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 

Call statements for each SQL query!?

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


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Mon Jun 12, 2006 3:13 am    Post subject: Call statements for each SQL query!? Reply with quote

Hi,

I am very sorry if this is very basic question.

I have a COBOL-DB2 program with embedded SQL statements.

SELECT EMP-NAME, EMP-AGE
FROM EMPTABL
WHERE EMP-LAST-NAME = 'KOLUSU';

SELECT EMP-NAME, EMP-GENDER
FROM EMPTABL
WHERE EMP-GENDER = 'F';

SELECT EMP-DOB, EMP-ADDR
FROM EMPTABL
WHERE EMP-FRST-NAME = 'KOLUSU';

Now, I would like to know how the COBOL converts them to the equivalent CALL statements of each.

Please explain in detail.

Thanks in advance.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Jun 12, 2006 3:25 am    Post subject: Reply with quote

ranga_subham,

After you pre-compile a COBOL-DB2 program , check for the compile listing in the spool and you wil be able to see the SQL statements being converted to equivalent CALL statements.

A sample of conversion would be below.Similarly check in the spool the entire conversion of SQL statements.
Code:
*****EXEC SQL                                   
*****         FETCH SELECT-CURSOR               
*****         INTO :EMPNO, :FIRSTNAME, :MIDINIT,
*****              :LASTNAME, :GENDER, :BIRTHDATE   
*****END-EXEC.                                   
     PERFORM SQL-INITIAL UNTIL SQL-INIT-DONE     
     CALL "DSNHLI" USING SQL-PLIST3.             

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Mon Jun 12, 2006 4:55 am    Post subject: Reply with quote

Thanks Shekar.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
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 -> 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