View previous topic :: View next topic
|
Author |
Message |
Kmr.deepakcs
New User
Joined: 11 Oct 2013 Posts: 37 Location: India
|
|
|
|
As all we know we cannot read a ps file randomly. I have a scenario like, I am reading a PS file of 1000 records. And at 400 records i got an abend. then I want to restart reading this file at last record read that is 400.
I searched forum but did not get answer....some one suggested to take a counter and save it in another file but what if read our file using counter it also reading all records before go to last records....It is not a solution as we are reading all previous Records.....
Like someone said ....You can use
perform count times....
Please give suggestions....
Deepak kumar |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why do you want to do this? |
|
Back to top |
|
|
Kmr.deepakcs
New User
Joined: 11 Oct 2013 Posts: 37 Location: India
|
|
|
|
Quote: |
Why do you want to do this? |
@bill woodger ...Just a question.....
Deepak kumar[/quote] |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
In order to do what you want, you have to store the last record read in a file somewhere since otherwise you have no way to know after an abend how many records to read and skip processing for. The easiest way to do so would be to define a VSAM KSDS to hold the last record read and update (read / rewrite) the KSDS record every time you read a record from your sequential file. This means your program will run longer and now depends upon having the VSAM file access so the logic becomes more complex.
Most of the time, simply designing the system to allow for a restart (either by allowing for the files to be restored to their state before the program started running, or by ensuring the updates can be applied multiple times in case a rerun is needed) will be the MUCH better solution |
|
Back to top |
|
|
trushant.w
New User
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
Hi Robert
I just need more clarification on your solution of using VSAM KSDS file.Below are my quries
1. How programe will come to know that as the job is restarted it needs to check the ksds for last record.
2.As we are using ps flat file as input,even after reading the last record form ksds how we will jump to that perticular record in ps file when job is restarted. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
1. You will have to indicate to the program in some way (such as a JCL PARM value or a specific value in the KSDS) whether the program should do a normal execution or a rerun.
2. You don't "jump" -- you read each and every record from the sequential file until you reach the last record processed. A sequential file means sequential -- as in, no skipping records, no jumping around in the file, read from the first record to the last record one at a time. So if your program got an ABEND after processing the first 400 records of the sequential file, your program while doing the rerun still has to read the first 400 records (even if it does nothing with the data on those records). |
|
Back to top |
|
|
trushant.w
New User
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
Thanks for explaination Robert.
I got the high level idea of checkpointing.
If possible please share some examples. |
|
Back to top |
|
|
Kmr.deepakcs
New User
Joined: 11 Oct 2013 Posts: 37 Location: India
|
|
|
|
Quote: |
So if your program got an ABEND after processing the first 400 records of the sequential file, your program while doing the rerun still has to read the first 400 records (even if it does nothing with the data on those records).
|
@Robert sample....Wht is Difference, We are reading 400 records,skipping wht,we just read all records.....I already know this solution and also the perform solutions...
Deepak kumar |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You also probably need to "sync" all of the other outputs that were partly created in the problem execution. Think about just an output file being only part complete. Think about totals that are incomplete. Etc.
There is Much more to restating in the middle than starting at the right place in the input . . .
In most cases, it is better to get the input data back to where it was before the run, fix whatever caused the problem, and rerun from the beginning. |
|
Back to top |
|
|
Kmr.deepakcs
New User
Joined: 11 Oct 2013 Posts: 37 Location: India
|
|
|
|
ok dick....I will try your suggestions...
Deepak kumar |
|
Back to top |
|
|
suraaj
New User
Joined: 16 Apr 2009 Posts: 69 Location: Canada
|
|
|
|
Another solution could be to add a date field to the file (if possible). Update all the records with the date the job was run. That way you would know when you rerun if the records where updated or no. Checking for current date in the date field would tell you if you need to process the record again.
Regards Suraaj |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
addding a field to provide a date field
especially for a PS file is a lot of work and overkill.
as computers get faster,
and as Dick Scherrer has often said,
batch processes
NOT INVOLVING UPDATE OF DB2
should be configured to be restartable,
by restoring all the files to the their state prior to the start of the process.
DB2 10 automatically provides a last-updated column
and restart should be configured around that column.
having worked in the IT industry (as many on this board have)
for several decades (starting in the 60's)
i have seen restart processes evolve,
just as every other process has evolved,
from stone wheels and knives
to rather simple process. |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
If your program is destined for production, you better make sure that you get the Operations team's blessing. They do not want to have to cope with special restart procedures that may be unique to your job; they want a standard procedure that all jobs follow. |
|
Back to top |
|
|
trushant.w
New User
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
Hi dbzTHEdinosauer
It would be a great help if you share some examples on restarting logic. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Kmr.deepakcs wrote: |
I am reading a PS file of 1000 records. And at 400 records i got an abend. then I want to restart reading this file at last record read that is 400. |
That's why check-point restart logic came in to existence. If it's just not a question and you plan to implement such a thing, suggest you should get acquainted about the check-point logic in use at your shop instead of deploying your own.
OTOH, if I'm good in guess then the first thing I'd like to ask is - why do you ask this? AFAIK, none of the non-mainframe languages also does not provides such a facility ; said that (the question does and does not sound to originate from PC world) - what is the basis of your question? |
|
Back to top |
|
|
Kmr.deepakcs
New User
Joined: 11 Oct 2013 Posts: 37 Location: India
|
|
|
|
@anuj
Thanks for your reply
Anuj,
i will try your checkpoint suggestion.....
Deepak |
|
Back to top |
|
|
|