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
 

 

Cobol - DB2 row retrieval.

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

New User


Joined: 03 Dec 2012
Posts: 35
Location: India

PostPosted: Fri Oct 16, 2015 10:44 am    Post subject: Cobol - DB2 row retrieval.
Reply with quote

Hi All,

I have a requirement to fetch records from DB2 table and write it to a sequential file. I have thousands of rows in DB2 table, so upon job failure I need to see to that after restart, program has to fetch the next row of last retrieved row.

How can we achieve this, as Fetch is based on where condition I.e we are not retrieving all the rows of a table.

Thanks,
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Oct 16, 2015 11:31 am    Post subject: Reply to: Cobol - DB2 row retrieval.
Reply with quote

If that is your entire requirement, why not just use a DB2 utility?

Even so, how do you feel it may fail, such that you have to code for failure?
Back to top
View user's profile Send private message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 35
Location: India

PostPosted: Fri Oct 16, 2015 11:51 am    Post subject: Reply to: Cobol - DB2 row retrieval.
Reply with quote

As I mentioned, I'm not retrieving all the rows of the table. Basically lots of rows has to be retrieved and as we are processing thousands of rows and if the jobs fails, I need to add a logic to retrieve from the next row from the last retrieved upon restart.

I thought, If I write a table key to other table2 each time I retrieve a row from the table1 and write to sequential file.

In this case, I need to update the another table for each write record process. Upon job failure, from the table we can get the key and fetch the next row from the table.

But how to use the key in the query to retrieve and continue retrieving next rows?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Oct 16, 2015 11:56 am    Post subject: Reply to: Cobol - DB2 row retrieval.
Reply with quote

OK, sticking to your program idea, how do you think the program may fail in the future? How many times a year do you feel it may fail? How long does it run for? And something you'll have to provide yourself, what is the overhead of having information available to "restart" it?

Then you can work out whether, over a 10+ year life, it would be worth having restart capability.

If it is never likely to fail in that time, why build restart? So why would you expect it to fail?
Back to top
View user's profile Send private message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 35
Location: India

PostPosted: Fri Oct 16, 2015 12:05 pm    Post subject: Reply to: Cobol - DB2 row retrieval.
Reply with quote

I'm just checking for the possibility.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Oct 16, 2015 10:08 pm    Post subject:
Reply with quote

Just out of curiosity, I ran a job that:
  1. Checks for the existence of GDG bases
  2. Creates said bases if they do not exist
  3. Unloads a table containing about 25,000 rows.

Elapsed time: 2 seconds.

Unless your machine is grossly inferior to mine, or you are doing extremely complex processing to determine (or in addition to determining) what rows to unload, having a restart capability is useless.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Sat Oct 17, 2015 12:57 am    Post subject:
Reply with quote

Please refer below link and look for Insensetive scrollable cursor and other options. also you will have an order by in your cursor.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNAPH11/2.2.2?DT=20010710165542

Quote:
I have a requirement to fetch records from DB2 table and write it to a sequential file. I have thousands of rows in DB2 table, so upon job failure I need to see to that after restart, program has to fetch the next row of last retrieved row.


Checkpoint and restart is used in case you have a Commit in your program. Otherwise a simple select statement doesn't have to be coded with restart logic. Has someone asked you to do that? and for your requirement as Bill said make a use of DB2 Utility unless you have any fancy cobol code.
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 IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am


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