IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reading a PS file when abend occurs


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Wed Oct 30, 2013 12:17 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Oct 30, 2013 2:16 pm
Reply with quote

Why do you want to do this?
Back to top
View user's profile Send private message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Wed Oct 30, 2013 2:27 pm
Reply with quote

Quote:
Why do you want to do this?

@bill woodger ...Just a question.....



Deepak kumar[/quote]
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Oct 30, 2013 2:59 pm
Reply with quote

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
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Wed Oct 30, 2013 3:59 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Oct 30, 2013 4:41 pm
Reply with quote

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
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Wed Oct 30, 2013 6:15 pm
Reply with quote

Thanks for explaination Robert.
I got the high level idea of checkpointing.

If possible please share some examples.
Back to top
View user's profile Send private message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Wed Oct 30, 2013 6:17 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Oct 30, 2013 7:03 pm
Reply with quote

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
View user's profile Send private message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Wed Oct 30, 2013 7:35 pm
Reply with quote

ok dick....I will try your suggestions...


Deepak kumar
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Thu Oct 31, 2013 8:15 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Oct 31, 2013 8:33 pm
Reply with quote

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
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Thu Oct 31, 2013 10:04 pm
Reply with quote

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
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Fri Nov 01, 2013 9:43 am
Reply with quote

Hi dbzTHEdinosauer

It would be a great help if you share some examples on restarting logic.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Nov 01, 2013 6:03 pm
Reply with quote

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
View user's profile Send private message
Kmr.deepakcs

New User


Joined: 11 Oct 2013
Posts: 37
Location: India

PostPosted: Fri Nov 01, 2013 6:45 pm
Reply with quote

@anuj

Thanks for your reply

Anuj,
i will try your checkpoint suggestion.....


Deepak
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top