View previous topic :: View next topic
|
Author |
Message |
hemanthj642
New User
Joined: 14 Sep 2005 Posts: 21
|
|
|
|
Hi Friends,
I am trying to learn about GSAM file as I have got to work on it.
Eariler I wrote a programs using check point /Restart logic for sequential files. Now I got a requirement to write a logic by using GSAM files.
After going thru the forum I understand that,basically GSAM files are used to do a check point/restart.
It would be helpful for me if some one clarify the below things.
For normal IMS data base when we issue a check point call position in the data base is lost. Application program need to be make sure that Repostioning the data base.
I saw the code for input GSAM files ..Code was written to go to GSAM(GN CALL) read if it is a restart call after successful restart.
how IMS make sure that file is read from a next record from previous check point ?
While Restart how IMS make sure that output GSAM file not write the duplicates?
Thanks in advance..
Regards,
Hemanth |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
IMS keeps track of the relative byte address associated with each GSAM read and write. The RBAs are stored in the log along with other checkpoint information. On restart, IMS uses the RBAs to automatically reposition the GSAM files in the right place.
An RBA can depend on the physical characteristics of the file, which is why you have to be very careful not to reblock a GSAM file when a restart is needed. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Eariler I wrote a programs using check point /Restart logic for sequential files. |
Interesting. As far as i know there is no checkpoint/rollback functionality for "sequential files".
Possibly there is something i misunderstand.
Also, if an organization permits/supports checkpoint/rollback, it is usually not done for a program or an individual application. There are standards concerning how this will be done and applications needing checkpoint/rollback must follow the standard(s). |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
To me, the weird thing about GSAMs is that you will see all the records in the file after an abend. So if you write 100 records, then takea checkpoint, then write 50 records, then have an abend, the output file will have 150 records in it.
When the restart call (XRST) runs, it moves the records pointer back to where the checkpoint was. So in essence, those last 50 records disappear.
Three things to be SUPER careful about:
1) Make sure that on a restart, you change the disposition of the output GSAMs from NEW to SHR.
2) Make sure that on a restart, you do NOT reopen the GSAM files with an OPEN call. That would put the record pointer back to beginning of the file.
3) Make double-damn CERTAIN that your program picks up the correct record during a restart. Think about where the record pointer was when the checkpoint was taken, then make sure that's the data you want.
For example, your logic reads the 100th GSAM record, then takes a checkpoint. The pointer is AFTER the 100th record. If you do a restart, then read a record, you are getting the 101st record.
I like it when programs take the checkpoint at the TOP of the logical loop. So you take a checkpoint, THEN read that 100th record to process it. That way, when you restart, you can simply drop into your logical loop and the first read picks up the 100th record.
A big advantage to that method is that if the 100th record is the problem, you can delete it from the input file and still do a successful restart. If you do it the other way, with the checkpoint after the read, the RBA for the restart is now invalid if you delete the record. |
|
Back to top |
|
|
hemanthj642
New User
Joined: 14 Sep 2005 Posts: 21
|
|
|
|
Hi Don,Ed,
Thank you for the info,it helped me a lot.
Hi Dick,
Sorry If I confuse you about sequential files checkpoint/Restart..
I meant... I used sequential file as an input instead of GSAM ... Read the sequential file for key value,used this key value to access the IMS data base.
Thanks,
Hemanth |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Sorry If I confuse you about sequential files checkpoint/Restart.. |
Not to worry - i've been "confused" many times
If you are reading a sequential file and making updates to a database, the process likely creates one or more reports and/or output sequentikal files. If this process is interrupted and is to be restarted "in the moiddle", consideration must also be given to getting the non-db output files back in sync. |
|
Back to top |
|
|
|