Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Work file processing using Natural Program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Java & MQSeries
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    Post subject: Work file processing using Natural Program
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

Site Director


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

PostPosted: Tue Oct 26, 2010 7:35 pm    Post subject:
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    Post subject: Reply to: Work file processing using Natural Program
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

Site Director


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

PostPosted: Wed Oct 27, 2010 2:37 am    Post subject:
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    Post subject: Reply to: Work file processing using Natural Program
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

Site Director


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

PostPosted: Wed Oct 27, 2010 7:12 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Java & MQSeries All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us