View previous topic :: View next topic
|
Author |
Message |
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
thanks for that .. but should we use a cursor?? |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
|