Writing Custom Batch Override Rules
The Scheduler uses override rules on the Batch Definitions form to determine if forming batches should be released even though they have not reached the minimum release quantity.
Override Rule Logic
Before you create custom batch override rules and write the corresponding batch override functions, you should understand the logic used by the override function. This rule is invoked under two conditions:
- When add override release reviews are enabled and a job is added to a forming batch, but the forming batch does not reach or exceed its minimum release quantity.
- During a periodic override release review, which occurs at an interval specified on the batch definition if the periodic review is enabled.
When the batch override function is called, it determines whether the forming batch should be released.
Naming the Function
Your custom override function can have any name that is not a standard user-callable function name.
Arguments
#include "factor.h" int borl(formbat, batch) FORMBAT *formbat; /* pointer to the forming batch */ BATCHDEF *batch; /* pointer to the batch definition */
The override function accepts two arguments, a pointer to forming batch (Type: FORMBAT *) and a pointer to the batch (Type: BATCHDEF *).
Return Value
The function returns TRUE (non-zero) if the forming batch should be released or FALSE (zero) if the forming batch should not be released (Type:int).
Here is an example of a batch override function based on the time greater than or equal to the override threshold:
int borl (FORMBAT *formbat, BATCHDEF *batch) /*----------------------------------------------------------------- Batch override rule which determines that the forming batch should be released if it has been waiting longer or equal to the override threshold. ARGS: formbat - pointer to the arriving forming batch batch - pointer to the batch that this load will follow RETURNS: true, if it has been waiting too long false, otherwise -----------------------------------------------------------------*/ { double x; x = cstnow - formbat->fbsttim; /* If the time the batch has been forming is at least the threshold, then release the batch */ if (x >= batch->btovth) { return(1) } else { return(0) } {
Installing the Custom Function
To make your custom override function available to the Scheduler, you must "install" it from ucini1 by calling the function sedfok. This function has two arguments in the following order:
- The number of the batch override rule for which your function contains custom logic
- The address of your batch override function
For example, to install the above example rule "borl" in rule position 39:
sedfok (39, borl);