Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Problem on CURSORS.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
appala_srinivas

New User


Joined: 30 Aug 2005
Posts: 3

PostPosted: Tue Aug 30, 2005 7:36 pm    Post subject: Problem on CURSORS.
Reply with quote

Hi All,

My Problem.
--------------

I have one DB2 Table(ex. Employee).

I want to create a Cursor it retrieve 10 records only at a time.
i execute it 2nd time, then it fetch from 11 to 20 records.
i execute it 3rd time, then it fetch from 21 to 30 records.
i execute it 4th time, then it fetch from 31 to 40 records.

like this way i fetch 100 records.

This query i will include in the sub-program. The main program calls the subprogram 10 times , so that i can retrieve 100 records.

Regards,
Srinivas.a
Back to top
View user's profile Send private message

krishnaiahc

New User


Joined: 31 Aug 2005
Posts: 21

PostPosted: Wed Aug 31, 2005 5:14 pm    Post subject:
Reply with quote

Hai,

By using Fetch first n rows only.... I think it will help for requirement..

Regards,
Krishna
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Mon Sep 05, 2005 4:18 pm    Post subject:
Reply with quote

Hi Srinivas,

Your requirement looks like a Scroll logic in an Online screen i.e. in a CICS+DB2 Program. To fulfill your requirement you need to do 2 things.

- Write a DB2 Cursor Query which is generic and fetches next 10 records to the given Variable.

Eg: SELECT COL1,COL2,Col3... INTO :HV-VAR1,:HV-VAR2,:HV-VAR3,.... WHERE MBNISS>:HV-MBNISS FETCH FIRST 10 ROWS ONLY;

- I hopes the HV-MBNISS will contain the last record fetched from the table. It means 10th record in first case, 20th in second ran .....
- If you want to exit and restart the program again and again (Other than online scrolling logic) You need to write last MBNISS to a file before closing the cursor. And when you start the program next time you read that file and execute this query.

I know this is not looking clear for you. But I expect you to come up with more details about your case.

Thanks,
Reddy.
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us