1.Functional Description
1.1Purpose
This function reads the Rated Capacity, Gross Capacity, Released Load, and Planned Load arrays to 
calculate the Available Capacity and Percent Capacity Used.  If the percent is outside the range 
specified in the input percent parameters, the function writes Over/Under Capacity messages to F3311.  The 
function also creates capacity load records in F3313.
1.2Setup Notes and Prerequisites
 The calling application must call B3300200, CRP, Initialize Bucket Dates, before calling this 
function.  The Bucket Date Array pointer returned by B3300200 must be passed as input to this function.
 The calling application must call B3300150 (CRP, Calculate Rated Capacity) and B3300220 (CRP, 
Calculate Released And Planned Load) to allocate and load the Rated and Gross Capacity arrays as well as the 
Released and Planned Load arrays.
1.3Special Logic
2.Technical Specifications
// calculate the percent of capacity used.  Write capacity load and message records
// CummTotal = 0
CNCAPM = CapacityMode
CNMCU = WorkCenter
CNUM = UnitOfMeasure
CNHCLD = 'A'
CNPID = "R3382"
Call B9800100 to get the current date (CNUPMJ), time (CNTDAY), workstation ID (CNJOBN), and user 
ID (CNUSER).
Do X = 1 to NumberOfPeriods
 If PastDuePeriods <> 0 or X > 1
 LoadTotal = ReleasedLoadArray[X] + PlannedLoadArray[X]
 If RatedCapacityArray[X] <> 0
 If LoadTotal < 0
 LoadTotal = 0
 End
 PCT = LoadTotal / RatedCapacityArray[X]
 PCT = PCT * 100
 Else
 PCT = 0
 End
 // If percentage is outside the processing option range, write a message to F3311
 If PCT <= UnderCapacityPercent and RatedCapacityArray[X] <> 0 and
 PastDuePeriods < X
 Call B3100490 to get the next Unique ID (CNUKID) value
 Write a message to F3311 with field values CNCMSG = 'U', 
 CNUORG = RatedCapacityArray[X].
 Write a message to F3311 with field values CNCMSG = 'O', 
 CNUORG = RatedCapacityArray[X].
 // Calculate the cumulative resource available
 Diff = RatedCapacityArray[X] - LoadTotal
 CummTotal = CummTotal + Diff
 // Write capacity load F3313 records
 CRCAPM = CapacityMode
 CRMCU = WorkCenter
 CRUM = UnitOfMeasure
 CRSTRT = BucketDateArray[X]
 If PastDuePeriods >= X
 If PastDuePeriods = 1
 CRSTRT = 0
 End
 If PastDuePeriods = 2
 If X = 1
 CRSTRT = 1/1/1900  // Used for Past Due Date 1. 
Equal to Julian date value 1
 Else
 CRSTRT = 1/2/1900  // Used for Past Due Date 2. 
Equal to Julian date value 2
 End
 End
 End
 If PrimeLoadCode = 'L' or 'B'
 CRUNTY = '1'
 End
 If PrimeLoadCode = 'M' or 'C'
 CRUNTY = '3'
 End
 CRTRQT = 0
 If CQT = 10
 If ReleasedLoadArray[X] < 0
 ReleasedLoadArray[X] = 0
 End
 CRTRQT = ReleasedLoadArray[X]
 CRTRQT = PlannedLoadArray[X]
 End
 End
 If CQT = 50 and PastDuePeriods < X
 CRTRQT = GrossCapacityArray[X]
 CRTRQT = RatedCapacityArray[X]
 End
 If CQT = 70 and PastDuePeriods < X
 CRTRQT = PCT
 End
 If CQT = 80 and PastDuePeriods < X
 CRTRQT = Diff
 End
 If CQT = 90 and PastDuePeriods < X
 CRTRQT = CummTotal
 End
 If CRTRQT <> 0 or CQT = 10
 Write a new record to F3313 using the assigned field 
values
 End
 End
 End
End
D3300210 - CRP, Analyze Capacity Arrays
Data Item Data Structure DescriptionI/ORequiredNotes
CAPM            Capacity Mode                  IY
MCU            Work Center                        IY
UM            Unit Of Measure                  IY
GENLNG      Bucket Date Array Ptr            IY      From B3300200
GENLNG      Rated Capacity Array Ptr      IY      From B3300150
GENLNG      Gross Capacity Array Ptr      IY      From B3300150
GENLNG       Released Load Array Ptr       IY      From B3300220
GENLNG      Planned Load Array Ptr            IY      From B3300220
INT01            Past Due Periods                  IY
INT01            Number Of Periods                  IY
PILC            Prime Load Code                  IY
PCT            Over Capacity Percent            IY
PCT            Under Capacity Percent            IY
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
^
| Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both | 
|---|---|---|---|---|
| cCapacityMode | CAPM | char | NONE | NONE | 
| A code indicating which planning is being used. Valid values are:
    1    Resource Requirements Planning
    2    Rough Cut Capacity 
 | ||||
| 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 
 | ||||
| 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. | ||||
| idRatedCapacityArrayPtr | GENLNG | ID | NONE | NONE | 
| General purpose ID variable. | ||||
| idGrossCapacityArrayPtr | GENLNG | ID | NONE | NONE | 
| General purpose ID variable. | ||||
| idReleasedLoadArrayPtr | GENLNG | ID | NONE | NONE | 
| General purpose ID variable. | ||||
| idPlannedLoadArrayPtr | GENLNG | ID | NONE | NONE | 
| General purpose ID variable. | ||||
| iPastDuePeriods | INT01 | integer | NONE | NONE | 
| Number of Days in Future to Query for Responses Due. | ||||
| iNumberOfPeriods | 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 
 | ||||
| mnOverCapacityPercent | PCT | MATH_NUMERIC | NONE | NONE | 
| An abbreviation for percentage. | ||||
| mnUnderCapacityPercent | PCT | MATH_NUMERIC | NONE | NONE | 
| An abbreviation for percentage. | ||||
| 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 
 | ||||
| mnF3311UniqueID | 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 
 | ||||
| B9800100 Get Audit Information | 
| F3311 Capacity Message File | ||||
| F3313 Capacity Load Table |