No, our backups are run in the evening and we are a strict 7am-5pm shop. The batch job that runs every hour is only run between 7 and 5.
Bob
-----Original Message-----
From: Steinmetz, Paul
Bob,
During any of these processes, do you run a daily save.
I found that when using a data area, the process will could/will fail during the save.
Instead of using a data area, we use a simple PF control file.
A PF can be saved while in use using Save While Active.
Data areas cannot.
Paul
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bob Cagle
Sent: Wednesday, May 18, 2016 4:12 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: [Bulk] Technique critique?
Mark
All good points. Yes, I have considered adding the message to the user to "Please try again later" instead of just locking up their session. I am going to implement this.
I have also considered using the 'lock object' method, but to switch this one program to that method means also modifying several other programs to the new paradigm. Not sure if I'm gonna tackle this one yet or not.
As for the nature of this interactive job, a more detailed explanation: it is creating Advanced Ship Notices in bulk on a JDE system. It is run once, maybe twice a day as part of our 'day end' process. There are other interactive processes that can also create the ASN. The batch job in question is our EDI process that runs every hour which pulls the ASNs, initiates communications, and then *updates these ASNs as sent*. It's the last part that I think was causing us a problem. If the user runs the interactive ASN generation while the EDI job is processing communications, then the new ASNs will be *updated as sent* before ever being added to the EDI translator. Earlier this week, we had several ASNs that didn't show up in the translator like they should. This is the only scenario I could come up with that would cause this.
Thanks for all the input!
Bob
From: Mark S Waterbury
Hi, Bob:
I think this is a rather "poor design" regardless of how that "loop" is coded ... for the following reasons:
* what happens if the batch job fails or aborts, and so never resets
the data area?
o (the interactive users will be stuck waiting forever ...)
* a loop like this needlessly ties up the user's interactive session ...
o perhaps it would be better to check the condition and then
notify the user to "Try again later..."
A few related questions may help to point to a better design:
* what is the nature of this batch job? Is it updating some "critical
resources" such as some file(s)?
* what is the nature of the program that is to run interactively, and
why can it not run while that batch job is active?
SUGGESTION
============
Instead of setting a flag value in that data area, you could use that data area as a "semaphore" (a resource that can be locked) and have the
batch job allocate the *DTAARA for *EXCLusive use ... Then, the
interactive CL program can attempt to issue ALCOBJ against that same data area, also trying to gain *EXCLusive use, and specify "no wait" and if it fails to allocate, you can monitor for that message with a MONMSG, and then notify the user to "please try again later" ... if more than one interactive user is allowed to run this interactive process at the same time, then you would want to immediately issue a DLCOBJ to de-allocate the lock on that data area, when the lock has been obtained.
The main benefit of this approach is that, when the batch job ends, normally or abnormally, the exclusive lock will be released.
Hope that helps,
Mark S. Waterbury
On 5/18/2016 2:45 PM, Bob Cagle wrote:
This is more of a CL programming question:
Background: I have an interactive program that I need to have NOT run while a specific batch job is running. Currently the batch job updates a data area with a flag at the start of the job and then clears it at the end. Interactive jobs can then check for this flag before running.
I have this code in my CL:
CHECK:
/* Check data area to see if job is running */ Rtvdtaara DataArea
rtnvar(&Check) If (&Check = '1') then( DO )
/* wait 30 seconds and then try again */
Dlyjob dly(30)
Goto CHECK
ENDDO
The GOTO is bothering me, so the question is - would you code this different? This seems simple and straight-forward, but in your opinion is there a better way?
Thanks
Bob Cagle
IT Manager
Lynk
As an Amazon Associate we earn from qualifying purchases.