Midrange News for the IBM i Community


Posted by: Chris Proctor
Programmer Analyst
Columbia Sports Company
Portland, OR
Preventing errors when opening files during backups?
has no ratings.
Published: 03 May 2013
Revised: 06 May 2013 - 1450 days ago
Last viewed on: 24 Apr 2017 (2420 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Preventing errors when opening files during backups? Published by: Chris Proctor on 03 May 2013 view comments(4)

Happy Friday, everyone. We have a job that we're testing that needs to run 24/7, despite backups. Of course, right now it's going into MSGW because it cannot open a file due to the backups. Is there any way of preventing the error and just bypassing the processing until it can open the files?

I'm sure there probably is, I'm just to stupid to figure it out! Lol.

Thanks!

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Preventing errors when opening files during backups?
Posted: 3 years 11 months 23 days 4 hours 46 minutes ago

You can intercept the message if you have a Break Handler.

I did this for a client recently. It does error handling for (I think) all jobs.

If you have COZTOOLS, you can run the SRVINSTALL program to install one, but it calls:

 

ADDEXITPGM EXITPNT(QIBM_QMH_HDL_INQEXT) +    
             FORMAT(INQE0100) PGMNBR(*LOW) + 
             PGM(COZTOOLS/SRVPANEL)          

 

The called progam can retrieve JOB attributes and the message and then make a decision as to whether to swallow it or do something else.

 

 

Posted by: chrisp
Premium member *
Portland, OR
Comment on: Preventing errors when opening files during backups?
Posted: 3 years 11 months 23 days 2 hours 23 minutes ago

Thanks for the tip, Bob. I was just thinking though, couldn't I just change the files to USROPN then open them with OPEN (E) and just exist the program if I receive an error? I don't really have to do any processing if it can't open the files. I just exit and try again next time.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Preventing errors when opening files during backups?
Posted: 3 years 11 months 22 days 22 hours 2 minutes ago

Sorry, I misread your post. I thought you had a backup procedure giving you a break message.

Yes, just do an ALCOBJ before you call your task and if it works, fine, if not then you can't continue.

Posted by: Paulster
Premium member *
Sweden and The Netherlands
Comment on: Preventing errors when opening files during backups?
Posted: 3 years 11 months 20 days 13 hours 35 minutes ago

I reckon the USROPN option is something to pursue. If you close the file after each time you're through with it and then open it again prior to next use, you'd get an error if the file would be locked by the backup. If the error occurs, you run a delay or whatever you want to do to handle it before you try opening the file again. No error means it's free to continue. There is the obvious issue of extra overhead for closing and opening the file all the time so I'd try record blocking of some sort.

You could easily create a little test-program with the above logic and using a file you know will be backupped and then you run it during the night to see if it does as suspected.

 

Good luck!

Paulster