procedure AdjustInstanceTypeAttrVal(
   ncReplicated: DSName,
   writableReplica: DSName,
   var replEntinfList: REPLENTINFLIST,
   prefixTable: PrefixTable) : boolean

Informative summary of behavior: The AdjustInstanceTypeAttrVal procedure adjusts the attribute value of instanceType attribute in replEntinfList parameter to an appropriate value that suits the NC replica on the client. The procedure returns true if further processing of replicated update in replEntinfList has to be performed. Otherwise, it returns false.

 instanceTypeAttrVal: ATTRVAL
 instanceTypeAdjustedAttrVal: ATTRVAL
 instanceTypeVal: ULONG
 instanceTypeAdjustedVal: ULONG
 ncSubRef: DSName
 instanceTypeAttrVal := ENTINF_GetValue(replEntinfList.Entinf,
     instanceType, prefixTable)
 if (instanceTypeAttrVal = null) then
   /* If instanceType attribute is not present in Entinf
    * then there is no value to adjust. */
   return true
 instanceTypeVal :=  ValueFromATTRVAL(
     instanceTypeAttrVal, Syntax(instanceType), prefixTable)
 if (IT_NC_HEAD in instanceTypeVal) and 
    (not ncReplicated = replEntinfList.Entinf.pName^)
   /* If IT_NC_HEAD is set in instanceTypeVal and 
    * replEntinfList.Entinf.pName is not the DSName of the root of the
    * NC replica that the client is replicating, then this object is 
    * a subordinate reference. Take this opportunity
    * to ensure that ncReplicated!subRefs has an entry for this
    * sub-ref object.
   ncSubRef := replEntinfList.Entinf.pName^
   if (not ncSubRef in ncReplicated!subRefs) then
     ncReplicated!subRefs := ncReplicated!subRefs + {ncSubRef}
   if ObjExists(ncSubRef)
     /* Ensure that all sub-ref objects have the flag IT_NC_ABOVE set. */
     if not IT_NC_ABOVE in ncSubRef!instanceType then 
       ncSubRef!instanceType := ncSubRef!instanceType + {IT_NC_ABOVE}     
     /* If the sub-ref object corresponds to a locally instantiated
      * child NC, then skip this update as the sub-ref object
      * will be updated when the child NC replicates in.
     if PartialGCReplicaExists(ncSubRef) then
       return false /* Skip processing this entry. */
   /* If sub-ref object does not exist or exists but the child NC is not 
    * locally instantiated, then continue processing this entry to 
    * add or update the sub-ref object.
   instanceTypeAdjustedVal := instanceTypeVal + {IT_NC_ABOVE,
   if (not writableReplica) and 
      (IT_WRITE in instanceTypeVal) then
     /* If the client NC replica is a partial replica then remove the
      * IT_WRITE flag from the instanceTypeVal to mark the object as
      * read-only.
     instanceTypeAdjustedVal := instanceTypeVal - {IT_WRITE}
     instanceTypeAdjustedVal := instanceTypeVal
 /* Set or reset instance type bits other than IT_WRITE and
  * IT_NC_HEAD. */
 instanceTypeAdjustedVal :=
 instanceTypeAdjustedAttrVal := ATTRVALFromValue(
   instanceTypeAdjusted, Syntax(instanceType), prefixTable)
 ENTINF_SetValue(replEntinfList.Entinf, instanceType, 
     instanceTypeAdjustedAttrVal, prefixTable)
 return true