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

Work file processing using Natural Program


IBM Mainframe Forums -> Java & MQSeries
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mushreyas

New User


Joined: 18 Jul 2008
Posts: 59
Location: Bangalore

PostPosted: Tue Oct 26, 2010 1:04 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Tue Oct 26, 2010 7:35 pm
Reply with quote

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

New User


Joined: 21 Nov 2009
Posts: 58
Location: California

PostPosted: Wed Oct 27, 2010 1:27 am
Reply with quote

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

Moderator Emeritus


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

PostPosted: Wed Oct 27, 2010 2:37 am
Reply with quote

Hello,

Quote:
it should not be used when human lives are at stake
And many places feel the same about their $, inventory, customers, etc. . . icon_smile.gif

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

New User


Joined: 18 Jul 2008
Posts: 59
Location: Bangalore

PostPosted: Wed Oct 27, 2010 12:56 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Wed Oct 27, 2010 7:12 pm
Reply with quote

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
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 -> Java & MQSeries

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
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
Search our Forums:

Back to Top