Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us