View previous topic :: View next topic
|
Author |
Message |
mushreyas
New User
Joined: 18 Jul 2008 Posts: 59 Location: Bangalore
|
|
|
|
I have a natural program which reads the DB file and after some processing write the details in ouput work file and updates DB file. However after processing some records the job fails, so when i restart i want the program to write the records to the work file in such a way that it should overwrite the selected already written records (during first run which failed) from the desired record position. You can consider the below scenario
READ
Process
Write
Fail
Update
END-READ
The failure occurs after the data is written to flat file and before the update has happened…so the question is how to overwrite the data written in the file when we restart the job.
Suppose after writing 20 records in the output file the job failed but when i restart program should write the data starting from 18th record.
Using DISP=MOD will apend the records at the end of the file but not from the desired position. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You need to talk with your database support and learn how (or even if) restart is to be done on your system.
There is much more to a proper restart than merely counting records to skip/process. . .
Due to the much faster cpu and dasd many places no longer even use this - it is easier and safer to restart from the beginning (rather than inventing some new complexity). |
|
Back to top |
|
|
Ralph Zbrog
New User
Joined: 21 Nov 2009 Posts: 58 Location: California
|
|
|
|
The solution is to make the WORK records uniquely identifiable, adding a sequence number if necessary. Each time you restart, "duplicate" records will be written - in your example, records 18, 19, and 20. In the next job step, sort the records by the unique key, and use parameters
Code: |
SUM FIELDS=NONE,EQUALS |
to remove the duplicates.
If you needed to add a sequence number to the end of the record (let's say after byte 80), it can be removed with
Code: |
OUTREC FIELDS=(1,80) |
This is standard Natural restart logic, but it should not be used when human lives are at stake (in hospital applications or in nuclear power plants), because it is possible to lose WORK records during unlikely events, such as a power failure. To guarantee success, STORE the records in Adabas as part of the transaction, then extract them to a WORK file in a separate job step. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
it should not be used when human lives are at stake |
And many places feel the same about their $, inventory, customers, etc. . .
If you do try to implement some kind of restart, also be aware that every output from the process must also be re-synced (running totals, reports, files, etc). |
|
Back to top |
|
|
mushreyas
New User
Joined: 18 Jul 2008 Posts: 59 Location: Bangalore
|
|
|
|
Thanks to both Ralph and Dick for their responses. I was looking exaclty from Natural Program point of view and not through JCL sort (which can be implemented but with changes to exisitng JCL). |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You're welcome, but it sounds like you have not yet grasped what all needs to be done. . .
Also, i am confused by the reference to the sort and/or jcl. . .
Before actually implementing what you believe is needed, suggest you talk with someone more experienced who has implemented this type of restart on your system. |
|
Back to top |
|
|
|