1.Functional Description
1.1Purpose
This function reads the Capacity Resource Profile table (F3303) and Detail Forecast table (F3460) to
calculate the loaded capacity for the input Work Center. This information is stored in the Loaded
Capacity Array and returned to the calling application. The function also writes Period Summary records
to F3312 containing the loaded capacity for each Item in the Work Center that has forecast data
available.
1.2Setup Notes and Prerequisites
The calling application must call B3300140, RRP, Initialize Bucket Dates, before calling this
function. The Bucket Date Array pointer returned by B3300140 must be passed as input to this function.
During the first call to this function, memory is allocated for the Loaded Capacity Array and is
returned to the calling application so that is can be reused on subsequent calls. The calling
application must call B4000460, FreePtrToDataStructure, to free the memory when processing is complete.
1.3Special Logic
2.Technical Specifications
If the LoadedCapacityArrayPtr is NULL or the PeriodSummaryArrayPtr is NULL
Allocate memory for the arrays to hold NumberOfPeriods math numeric values
If the allocation fails
ErrorMessageID = '4374'
Exit the function with an error return code
End
End
// Read the resource profile and forecast file and load the loaded capacity array.
// Write Period Summary records.
Declare PeriodSummaryArray as an array of 56 math numerics
Clear the LoadedCapacityArray
Clear the PeriodSummaryArray
SaveItem = 0
If UnitOfMeasure = 'HR'
If PrimeLoadCode = 'L' or 'B'
LaborFlag = '1'
End
If PrimeLoadCode = 'M' or 'C'
MachineFlag = '3'
End
If PrimeLoadCode = 'B' or 'C'
LaborAndMachineFlag = '2'
End
Else
OtherUOMFlag = '9'
End
FirstPass = TRUE
Move the input Forecast Types to a ForecastTypeArray
CWCAPM = '1'
CWDCTO = 'FC'
CWMCU = WorkCenter
CWMMCU = Branch
CWUM = UnitOfMeasure
If UnitOfMeasure = 'HR'
If PrimeLoadCode = 'L' or 'B'
CWUNTY = '1'
End
If PrimeLoadCode = 'M' or 'C'
CWUNTY = '3'
End
Else
CWUNTY = '9'
End
Select F3303 records using key values Branch, WorkCenter, and UnitOfMeasure
Do while not EOF F3303
Read the next F3303 record
If F3303 read successful
If CTUNTY = LaborFlag, MachineFlag, LaborAndMachineFlag, or OtherUOMFlag
If CTTIMB <> LastTimeBasisCode
Call X0005 to retrieve the TimeBasisFactor for CTTIMB
Convert DL02 (TimeBasisFactor) from F0005 to numeric
If call to X0005 not successful
TimeBasisFactor = 1
End
End
// When Item changes, write period summary for previous item
If FirstPass = FALSE and SaveItem <> CTITM
CWITM = SaveItem
CWMMCU = SaveWorkCenter
Do X = 1 to NumberOfPeriods
If BucketDateArray[X] > 0 and PeriodSummaryArray[X] > 0
CWDRQJ = BucketDateArray[X]
// Check for past due dates
If PastDuePeriods >= X
If PastDuePeriods = 1
CWDRQJ = 0
End
If PastDuePeriods = 2
If X = 1
Date 1. Equal to Julian date value 1
Date 2. Equal to Julian date value 2
End
End
CWTRQT = PeriodSummaryArray[X] rounded to 0
decimals
CWUORG = LoadedCapacityArray[X] rounded to 0
decimals
Write a new record to F3312 using the assigned
field values
End
End
Clear the PeriodSummaryArray
End
FirstPass = FALSE
// Load forecast data into appropriate date buckets
SaveItem = CTITM
MFITM = CTITM
MFMCU = Branch
Round CTTRKS to 0 decimals
Round CTUORG to 0 decimals
SaveRequestedDate = 0
X = 0
F = 1
Do while ForecastTypeArray[F] <> blank and F < 5
MFTYPF = ForecastTypeArray[F]
Select records from F3460 using key values MFITM, MFMCU, and
MFTYPF where
MFDRQJ >= (CTEFFF + CTTRKS) and MFDRQJ <= (CTEFFT + CTTRKS)
Do while F3460 fetch successful
Read the next F3460 record
If the fetch was successful and MFDRQJ > 0
SaveRequestedDate = MFDRQJ - CTTRKS
X = X + 1
index X that is >= SaveRequestedDate .
MFFQT = (MFFQT / TimeBasisFactor) * CTUORG
Round MFFQT to 9 decimals
LoadedCapacityArray[X] =
LoadedCapacityArray[X] + MFFQT
PeriodSummaryArray[X] = PeriodSummaryArray[X]
+ MFFQT
End
End
End
F = F + 1
End
End
End
End
// Write the period summary for the last item processed
Do X = 1 to NumberOfPeriods
If BucketDateArray[X] > 0 and PeriodSummaryArray[X] > 0
CWDRQJ = BucketDateArray[X]
// Check for past due dates
If PastDuePeriods >= X
If PastDuePeriods = 1
CWDRQJ = 0
End
If PastDuePeriods = 2
If X = 1
date value 1
date value 2
End
End
CWTRQT = PeriodSummaryArray[X] rounded to 0 decimals
CWUORG = LoadedCapacityArray[X] rounded to 0 decimals
Write a new record to F3312 using the assigned field values
End
End
D3300160 - RRP, Calculate Loaded Capacity
Data Item Data Structure DescriptionI/ORequiredNotes
MCU Work Center IY
MMCU Branch IY
UM Unit Of Measure IY
GENLNG Bucket Date Array Ptr IY From B3300140
INT01 Past Due Periods IY
INT01 Number Of Periods IY
PILC Prime Load Code IY
TYPF Forecast Type 1 I
TYPF Forecast Type 2 I
TYPF Forecast Type 3 I
TYPF Forecast Type 4 I
TYPF Forecast Type 5 I
GENLNG Loaded Capacity Array Ptr I/OY
SUPPS Suppress Error Message I '1' = Suppress runtime error
message
handling
' ' = Allow runtime error
message handling
DTAI Error Message ID O ' ' = Success
'3143' = Table access error
'4374' = Memory allocation
failed
^
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
szWorkCenter | MCU | char | NONE | NONE |
An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit
| ||||
szBranch | MMCU | char | NONE | NONE |
A code that represents a high-level business unit. Use this code to refer to a branch or plant that might have departments or jobs, which
| ||||
szUnitOfMeasure | UM | char | NONE | NONE |
A user defined code (00/UM) that identifies the unit of measurement for an amount or quantity. For example, it can represent a barrel, box,
| ||||
idBucketDateArrayPtr | GENLNG | ID | NONE | NONE |
General purpose ID variable. | ||||
nPastDuePeriods | INT01 | integer | NONE | NONE |
Number of Days in Future to Query for Responses Due. | ||||
nNumberOfPeriods | INT01 | integer | NONE | NONE |
Number of Days in Future to Query for Responses Due. | ||||
cPrimeLoadCode | PILC | char | NONE | NONE |
A code that determines if a work center is machine or labor intensive. The system also uses prime load codes in Resource Requirements
| ||||
szForecastType | TYPF | char | NONE | NONE |
A user defined code (34/DF) that indicates one of the following:
o The forecasting method used to calculate the numbers displayed about
| ||||
szForecastType2 | TYPF | char | NONE | NONE |
A user defined code (34/DF) that indicates one of the following:
o The forecasting method used to calculate the numbers displayed about
| ||||
szForecastType3 | TYPF | char | NONE | NONE |
A user defined code (34/DF) that indicates one of the following:
o The forecasting method used to calculate the numbers displayed about
| ||||
szForecastType4 | TYPF | char | NONE | NONE |
A user defined code (34/DF) that indicates one of the following:
o The forecasting method used to calculate the numbers displayed about
| ||||
szForecastType5 | TYPF | char | NONE | NONE |
A user defined code (34/DF) that indicates one of the following:
o The forecasting method used to calculate the numbers displayed about
| ||||
idLoadedCapacityArrayPtr | GENLNG | ID | NONE | NONE |
General purpose ID variable. | ||||
cSuppressErrorMessage | SUPPS | char | NONE | NONE |
A flag indicating whether or not runtime error messaging will occur when an error message is issued from a business function.
0 = allow
| ||||
szErrorMessageID | DTAI | char | NONE | NONE |
A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or
| ||||
mnF3312UniqueID | UKID | MATH_NUMERIC | OPT | NONE |
This field is a unique number used to identify a record in a file. | ||||
szWorkcenterBranch | WMCU | char | OPT | NONE |
This is the branch/plant to which the work center belongs and must exist in the business unit master (F0006) and branch plant constants file
|
B9800420 Get Data Dictionary Definition | ||||
X0005 Get User Defined Codes |
F3303 Capacity Resource Profile | ||||
F3312 Capacity Pegging | ||||
F3460 Forecast File |