Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help New to DB2 bactch coding

Status
Not open for further replies.

ding1000ma

Programmer
Sep 2, 2001
10
US
Hi,
I am trying to code a batch program.Can anyone suggest me what steps should i take care regarding the abends.Like if the program abends after processing few records and when i restart my job it should continue from the record where it abended.
Thanks,
Ding
 
U can store the commit counter (number of records committed) in a file (maybe VSAM??); the program should first look this file for the commit counter and skip processing that many number of records. This was how I had solved this problem. Any other suggestions are welcome!!

Rathna.
 
Ding,
As Rathna implied, it depends upon the type of processing being performed. If you are just reporting, then forget about restarts etc. If you are updating, you need to decide if you are going to be updating large amounts of data or not in one run. If you are not, then probably best to just abend and let the abend back out all uncommitted changes. If the program is to update a large amount of data in one go, then COMMIT points should be considered, and a mechanism for storing (and using in subsequent runs) the key of the last committed row, should be built in to the program.
Hope this helps
Marc
 
Hi Marc,
Thanks for the help.As you said that if the job is reporting then forget about restart. How is this possible to continue reporting where it last generated the report?
If i restart the job then again it is going to print from the begining of the first record.In which we are wasting time and resources.
When updating in one run:Can u correct me if i am wrong
So when you are updating the record in one run then i should store the last commited record in a table or a vsam file so that when the restart job runs then it will read from that table or vsam file and process the record.
Thanks,
Ding
 
Hi Ding,
Hmmm.... I can see you point about wasting time and resources on a report, but would say (in my experience) that this is not always the case, we are talking mainframes here right? The majority of batch reports on a mainframe are quite small and so running them again is not a big issue. For large reports, then this is possibly true, but you could argue that if it takes a while to correct the problem and you restart, the data may have changed. If you restart from a set point you could miss data, which may or may not be correct. You will need to look at the application and decide which is the best method. If you plan to use restart (in either reports or update programs) then the program must be written to accept the restart key (possibly as a parm, or from a file, or even from another DB2 table) and process from that point onwards. The SQL will need to be written from the outset to process in this way.
Once again, hope this is of some use.
Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top