Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
DB2 Cursor implementation

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
Zohaib

New User


Joined: 03 May 2008
Posts: 1
Location: Mumbai

PostPosted: Sun May 04, 2008 9:51 am    Post subject: DB2 Cursor implementation
Reply with quote

Hi,
I need to modify a cursor but i am a bit confused how to do that. Need your expertise.

===================
Here is the CURSOR:-
===================
SELECT
VALUE(TABA.BILL_RSN_CODE,' '), DPASCD.IDN
, DPASCD.PMT_DUE_DATE, DPASCD.BILL_DATE
, DPASCD.BILL_MONTH, DPASCD.BILL_YEAR
, TABA.REVENUE_MO, TABA.REVENUE_YR
, TABA.PAYMENT_DUE_DATE, DPASCD.PMT_DUE_DLRS
FROM (SELECT
B.IDN AS DPAPLN_IDN,
A.BILL_RSN_CODE,
A.REVENUE_MO,
A.REVENUE_YR,
A.PAYMENT_DUE_DATE,
A.BILL_CYC_NUM
FROM CBIS.BILL_INFO_HIST A,
CBIS.DEFERRED_PMT_PLAN B
WHERE B.IDN = 2128597
AND B.CUSACC_IDN = A.CUSACC_IDN
AND A.CREATE_TMSTMP >= B.MONETARY_TMSTMP) AS TABA
LEFT OUTER JOIN CBIS.DPA_PMT_SCHED DPASCD
ON TABA.DPAPLN_IDN = DPASCD.DPAPLN_IDN
AND INTEGER(TABA.REVENUE_MO) = DPASCD.BILL_MONTH
AND INTEGER(TABA.REVENUE_YR) = DPASCD.BILL_YEAR
ORDER BY DPASCD.PMT_DUE_DATE ASC
WITH UR;

===================================
here is what i want to implement in this cursor:---
===================================

When BILL_CYC_NUM = 1
AND DPASCD.BILL.DATE = 25 TO 31 (MONTH END DATES)

PERFORM FOLLOWING:---

WHEN REVENUE_MO = 1
SET REVENUE_MO = 12
AND REVENUE_YR = REVENUE_YR - 1

WHEN REVENUE_MO <> 1
THEN
REVENUE_MO = REVENUE_MO - 1


FOR OTHER THAN BILL_CYC_NUM 1 PERFORM THE CURSOR OPERTAION AS IT IS (just like before modification).

Thanks,
Zohaib
Back to top
View user's profile Send private message
References
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1