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

convert query to program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 1287
Location: Chennai, India

PostPosted: Wed Aug 13, 2008 11:09 am
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
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: 1287
Location: Chennai, India

PostPosted: Wed Aug 13, 2008 11:36 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts RC query -Time column CA Products 3
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
Search our Forums:

Back to Top