Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

convert query to program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
anand tr

New User


Joined: 12 Aug 2008
Posts: 41
Location: chennai

PostPosted: Wed Aug 13, 2008 10:57 am    Post subject: convert query to program
Reply with quote

hi.. am new to this forum as well as to cobol ... if we want to convert a query into a db2 prog wat is to be done? for eg let us consider this query..
SELECT
DEPT_NUM,
PO_MSTR,
ORD_DTE,
CREATE_DATE,
DAYS(POR.CREATE_DATE) - DAYS(POR.ORD_DTE),
BUYER_CD,
DIV_NUM
FROM DB2PQ.TQ1POLPR ,
DB2PQ.TQ1POPAR
WHERE
PO_NUM_PRE = 66
AND PO_PRE = PO_PRE
AND PO_MSTR = PO_MSTR
AND CREATE_DATE BETWEEN (CURRENT_DATE - 8 DAYS)
AND (CURRENT_DATE - 2 DAYS)
ORDER BY
BUYER_CD,
PO_MSTR,
ORD_DTE,
CREATE_DATE,
DIV_NUM;
PLease help me out... am new to mainframes...
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Aug 13, 2008 11:09 am    Post subject: Reply to: convert query to program
Reply with quote

Anand,

Quote:
if we want to convert a query into a db2 prog wat is to be done?


Your question is not that clear and have assumed few things.

You will have to have a DCLGEN INCLUDEd in your cobol-DB2 program and then you can straightaway add this query in the cobol program.

You can then SELECT into your DCLGEN variables.

Hope this helps.
Back to top
View user's profile Send private message
anand tr

New User


Joined: 12 Aug 2008
Posts: 41
Location: chennai

PostPosted: Wed Aug 13, 2008 11:15 am    Post subject:
Reply with quote

thanks for that .. but should we use a cursor??
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Aug 13, 2008 11:36 am    Post subject: Reply to: convert query to program
Reply with quote

Anand,

Quote:
but should we use a cursor??


If your SELECT is going to fetch more than a row, then CURSOR should be used.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us