Setup rules (determining whether a setup is necessary)

To determine whether a setup is necessary, you can write a function ucwtsr that will be called every time a non-standard system When-to-Setup rule is referenced (rule number greater than 2) and the standard step time rules 4 (Setup Lookup Table), 5 (Fixed Setup Time), 9 (Pre-Setup Table) or 10 (Pre-Setup Fixed) are called to compute the step time for the setup portion of the Operation. Function ucwtsr must have five arguments:

  1. A pointer to a load, Type: LOAD*.
  2. Type of resource (“R”esource), Type: char.
  3. A pointer to a resource, Type: void*.
  4. A pointer to an operation, Type: JOBSTEP*.
  5. When-to-setup rule, Type: int.

It returns 1 for success and 0 for failure (Type: int).

The following example of ucwtsr sets up a resource every time the item and/or operation changes for the resources.


int ucwtsr(LOAD *ldp, char type, void *rp, JOBSTEP *jsp, int rule)
/*-----------------------------------------------------------------
   Function to set up resource if the item or operation is different from 
last setup

   ARGS:
    ldp - pointer to load
    type - "R"esource
    rp  - pointer to resource
    jsp - pointer to operation
    rule - when-to-setup rule

   RETURNS
    true - perform setup, or
    false - do not perform setup
-----------------------------------------------------------------*/
{
   int ireturn = 0
   char error[400];

   /* Check if setup, setup/operation, or super jobstep.  */
   if ( (jsp->jstype != 4) && (jsp->jstype != 13) && (jsp->jstype != 19))
   {
     sprintf(error,"Jobstep not a Setup or Setup/Operate or Super 
          \n\nOrder ID %s\nLoad ID %d\nBatch ID 
          %ld\nJobstep ID %s\nJobstep Type %d\n", 
          ldp->loordp->orid, ldp->loid, (ldp->lobat == NULL) 
          ? OL : ldp->lobat->bibatid, jsp->jsid, jsp->jstype);
     seferr(0, error);
   }
   ireturn = (((RESRC *)rp)->rsptst != ldp->loordp->orptpt
         ||  ((RESRC *)rp)->rsjsst != jsp) ? 1 : 0;
   return (ireturn);
}

It is not necessary to install ucwtsr in ucini1 since it is called automatically when the setup rule is greater than 2 (i.e., a non-standard rule number).