Subject: ARMRCALC19
Function: arcgen(enditem)
The arc-generating function (arcgen) generates a series of data records based on a very specific spawning view.
ARMRCALC will normally process a calc bracket for each data term of the data view. This is not the case with arcgen. When arcgen appears in a calc bracket, ARMRCALC performs a single pass. Therefore the call to the arcgen function should be the only statement in the calc bracket. Any other statements in the same bracket would only be executed for the very first data term!
Although arcgen has general application we describe it first with a specific example. One of our applications requires that we spread overhead cost over a series of production projects.
Hours are collected in an ARMR data base. A relevant subset of the data base fields and their contents are as follows:
PROJECT ENDITEM TOTOHRS TYPE ------- ------- ------- ---------- wbs1 wbs1 prdhrs1 production wbs2 wbs2 prdhrs2 production wbs3 wbs3 prdhrs3 production wbs4 wbs4 prdhrs4 production wbs5 0 ovhhrs2 overhead wbs6 0 ovhhrs3 overhead wbs7 0 ovhhrs4 overhead wbs8 0 ovhhrs5 overhead
It is required that the overhead hours be "peanut-buttered" over all of the production projects based on some equitable allocation scheme. In order to do this we use arcgen to replicate records such that the following pages can be processed with ARMRCALC:
page 1 page 2 page 3 page 4 ------------- ------------- ------------- ------------- ENDITEM: wbs1 ENDITEM: wbs2 ENDITEM: wbs3 ENDITEM: wbs4 ------------- ------------- ------------- ------------- PROJECT ... PROJECT ... PROJECT ... PROJECT ... ------- ------- ------- ------- wbs1 wbs2 wbs3 wbs4 wbs5 wbs5 wbs5 wbs5 wbs6 wbs6 wbs6 wbs6 wbs7 wbs7 wbs7 wbs7 wbs8 wbs8 wbs8 wbs8
In order to generate the above records we copy the overhead records once for each production set. For each copy arcgen must substitute the production's ENDITEM value into the target records EDITEM field.
Note: We omit the details about how we allocate the hours. Here we only want to show how arcgen generates a data structure which is a crucial incredient required in the solution of the allocation problem.
Arcgen requires a data view which identifies the data groups to which the product is to be applied. In our example we need to clearly organize production and overhead record groups.
The following data view statements will do this for us:
header= g1 g2 ... gn columns= enditem
The arcgen call is as follows:
arcgen(enditem)
The above data view gives us a any number of pages with ENDITEM=0 (overhead set) followed by any number ENDITEM not equal to zero (production set). For our example let's concentrate on the single page case; i.e. assume we have omitted header= or that the pruned data base contains a single combination of g1 g2 ... gn.
In our example, the column to be processed is as follows:
ENDITEM ------- 0 overhead records for PROJECT wbs5 wbs6 wbs7 wbs8 wbs1 production record(s) wbs2 production record(s) wbs3 production record(s) wbs4 production record(s)
ARCGEN will produce no output unless the first columnar line contains a zero!
If the first line does contain ENDITEM=0, as shown above, ARCGEN copies the first line's records three times. The production records' ENDITEM value will be stored in the copies' ENDITEM field. Finally we store the last production enditem (wbs4) in the first columnar line. The output is basically as follows:
ENDITEM ------- wbs4 overhead records for PROJECT wbs5 wbs6 wbs7 wbs8 wbs1 production record(s) wbs2 production record(s) wbs3 production record(s) wbs4 production record(s) wbs1 overhead records for PROJECT wbs5 wbs6 wbs7 wbs8 wbs2 overhead records for PROJECT wbs5 wbs6 wbs7 wbs8 wbs3 overhead records for PROJECT wbs5 wbs6 wbs7 wbs8