All subscripts will be calculated before merge command will start global merge, so looks like you hit this command several (at least 2) times within a second. Since you don't have $JOB as a subscript or data node it also could be that it's done from different processes.
On the other hand, it's considered a good code practice to assign $h to a variable somewhere at the top of the method, and use that variable instead of $h throughout the code.
Consider this code for example:
if (DAYNUM-$H>0) && (WKS>2) do ....
if (DAYNUM-$H<=0) && (WKS>2) do ....
You want to check if date is in future and do something different if it is. You would expect that only one branch of code would ever run; however in extremely rare circumstances when this code runs around midnight $h could change between first and second if statements and run both code branches, screwing up your database unpredictably.
Another good practice is to pass "current date" as method argument instead of assigning $h inside a method. This way it's much easier to test methods.
- Log in to post comments