View previous topic :: View next topic |
Author |
Message |
sateesh_gontla Beginner
Joined: 23 Jan 2004 Posts: 40 Topics: 16 Location: Bangalore
|
Posted: Wed Aug 08, 2007 12:39 pm Post subject: Cursor in cobol |
|
|
I have the following requirement :
DB2 Table : Region_tab
Fields :
--------
Region
Member
Sel_opt
Score
If the input is given as From Region as :10 & To Region as :20
In the cobol program we need to do this using CURSORS:
Select all the members of Region 10 where Sel_opt = 'Y' and update the same member in Region 20 with score if that member exists in Region 20.
The 2nd requirement :
Fields in Table :
Region
Div
Member
Score
Limit
If any members score = Limit then make the score = 0 by Div wise and By Region wise. basically we need to read under a Region all the Division and under each Division all the members. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Aug 08, 2007 1:14 pm Post subject: |
|
|
sateesh_gontla,
what exactly do u want us to do here?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
sateesh_gontla Beginner
Joined: 23 Jan 2004 Posts: 40 Topics: 16 Location: Bangalore
|
Posted: Wed Aug 08, 2007 1:24 pm Post subject: |
|
|
will you able to help getting the sql's ? |
|
Back to top |
|
|
sateesh_gontla Beginner
Joined: 23 Jan 2004 Posts: 40 Topics: 16 Location: Bangalore
|
Posted: Wed Aug 08, 2007 5:53 pm Post subject: |
|
|
Any HELP !!!! |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Aug 09, 2007 8:00 am Post subject: |
|
|
sateesh_gontla,
Do NOT demand a solution. We are just helping in our part time. Just because you posted a question that does NOT mean that we drop everything and spoon feed you. We have a job of our own.
1.Solution for rqmt # 1
Cursor definition
Code: |
SELECT MEMBER
,SCORE
FROM TABLE
WHERE REGION = 10
AND SEL_OPT = 'Y'
|
Code: |
1.open cursor
2.fetch cursor
3.perform update
repeat steps 2 & 3 till the end of cursor
|
Code: |
UPDATE TABLE
SET SCORE = :WS-SCORE-FETCHED-FROM-CURSOR
WHERE MEMBER = :WS-MEMBER-FETCHED-FROM-CURSOR
EVALUATE SQLCODE
WHEN +0
WHEN +100
CONTINUE
WHEN OTHER
PERFORM ABEND
END-EVALUATE
|
2.Solution for rqmt # 2.
Code: |
UPDATE TABLE
SET SCORE = 0
WHERE SCORE = LIMIT
|
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
sateesh_gontla Beginner
Joined: 23 Jan 2004 Posts: 40 Topics: 16 Location: Bangalore
|
Posted: Thu Aug 09, 2007 9:02 am Post subject: |
|
|
Mr.Kolusu,
I never demand any thing, I said "will you able to help" , hope you understand (my) english... if you are willing or don't have time no one here asked/demand anything .....
It's only Request.... Also the solution that you gave me was not correct, please look at my requirements, it is a self join....However thank for your kind help !!!!! |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Aug 09, 2007 9:15 am Post subject: |
|
|
Quote: |
I never demand any thing, I said "will you able to help" , hope you understand (my) english... if you are willing or don't have time no one here asked/demand anything .....
|
sateesh_gontla,
Well Now I need an english lesson from you.
Why are you bumping the thread ? Isn't it like demanding?
Quote: |
Also the solution that you gave me was not correct, please look at my requirements, it is a self join....However thank for your kind help !!!!!
|
what is a self join? And I may be wrong but that is what I deciphered from your detailed requirement description
Either way you are free to seek solutions from other board
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Thu Aug 09, 2007 9:31 am Post subject: |
|
|
"Also the solution that you gave me was not correct, please look at my requirements,..."
What have you tried so far? _________________ ....Terry |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
aquarian Beginner
Joined: 28 Sep 2005 Posts: 66 Topics: 17 Location: Mars
|
Posted: Mon Aug 13, 2007 4:51 am Post subject: |
|
|
Seems some serious issue here _________________ cheers,
Aquarian |
|
Back to top |
|
|
sateesh_gontla Beginner
Joined: 23 Jan 2004 Posts: 40 Topics: 16 Location: Bangalore
|
Posted: Tue Aug 21, 2007 9:14 am Post subject: |
|
|
Hi Kolusu,
Please remove all my posts here and Thanks for all your support. I will not disturb you any more !!!
PLEASE REMOVE MY POSTS. Thanks for your help.\ |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Aug 21, 2007 9:45 am Post subject: |
|
|
Quote: |
Please remove all my posts here and Thanks for all your support. I will not disturb you any more !!!
PLEASE REMOVE MY POSTS. Thanks for your help
|
sateesh_gontla,
The post canNOT be removed as some of the posts have solutions.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Tue Aug 21, 2007 10:09 am Post subject: |
|
|
Many years ago, I received a card which said: 'you are not completely useless, you do serve as a good 'Bad example'. I have found someone to whom I can pass this card! _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
|
|