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 IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am


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