CRPAnalyzeCapacityArrays

CRP, Analyze Capacity Arrays

Minor Business Rule

Object Name: B3300210

Parent DLL: CMFG

Location: Client/Server

Language: C

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

// Compare the Released and Planned Load arrays to the Rated Capacity array to 
// 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', 

CNDRQJ = BucketDateArray[X], CNSTRT = 0, CNTRQT = LoadTotal,
CNUORG = RatedCapacityArray[X].

End

If (PCT >= OverCapacityPercent and PastDuePeriods < X) or
   (PCT = 0 and LoadTotal <> 0 and  PastDuePeriods < X)
Call B3100490 to get the next Unique ID (CNUKID) value
Write a message to F3311 with field values CNCMSG = 'O', 

CNDRQJ = BucketDateArray[X], CNSTRT = 0, CNTRQT = LoadTotal,
CNUORG = RatedCapacityArray[X].

End


// 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

Do CQT = 10 to 90 incrementing by 10
CRCQT = CQT

CRTRQT = 0

If CQT = 10

If ReleasedLoadArray[X] < 0

ReleasedLoadArray[X] = 0

End

CRTRQT = ReleasedLoadArray[X]

End
If CQT = 20

CRTRQT = PlannedLoadArray[X]

End

If CQT = 30
CRTRQT = LoadTotal

End

If CQT = 50 and PastDuePeriods < X

CRTRQT = GrossCapacityArray[X]

End
If CQT = 60 and PastDuePeriods < 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


Data Structure

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 NameData ItemData TypeReq/OptI/O/Both
cCapacityModeCAPMcharNONENONE

A code indicating which planning is being used. Valid values are:     1    Resource Requirements Planning     2    Rough Cut Capacity 
Planning     3    Capacity Requirements Planning

szWorkCenterMCUcharNONENONE

An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit 
might be a warehouse location, job, project, work center, branch, or plant. You can assign a business unit to a document, entity, or person for 
purposes of responsibility reporting. For example, the system provides reports of open accounts payable and accounts receivable by 
business unit to track equipment by responsible department. Business unit security might prevent you from viewing information about business units 
for which you have no authority.

szUnitOfMeasureUMcharNONENONE

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, 
cubic meter, liter, hour, and so on.

idBucketDateArrayPtrGENLNGIDNONENONE

General purpose ID variable.

idRatedCapacityArrayPtrGENLNGIDNONENONE

General purpose ID variable.

idGrossCapacityArrayPtrGENLNGIDNONENONE

General purpose ID variable.

idReleasedLoadArrayPtrGENLNGIDNONENONE

General purpose ID variable.

idPlannedLoadArrayPtrGENLNGIDNONENONE

General purpose ID variable.

iPastDuePeriodsINT01integerNONENONE

Number of Days in Future to Query for Responses Due. 

iNumberOfPeriodsINT01integerNONENONE

Number of Days in Future to Query for Responses Due. 

cPrimeLoadCodePILCcharNONENONE

A code that determines if a work center is machine or labor intensive. The system also uses prime load codes in Resource Requirements 
Planning and Capacity Requirements Planning calculations to develop load profiles. Valid codes are:    L Run labor hours only    M Machine 
hours only    B Run labor plus setup labor hours    C Machine plus setup hours    O Other (will not generate resource units)

mnOverCapacityPercentPCTMATH_NUMERICNONENONE

An abbreviation for percentage.

mnUnderCapacityPercentPCTMATH_NUMERICNONENONE

An abbreviation for percentage.

cSuppressErrorMessageSUPPScharNONENONE

A flag indicating whether or not runtime error messaging will occur when an error message is issued from a business function.        0 = allow 
runtime error message handling.        1 = suppress runtime error message handling.

szErrorMessageIDDTAIcharNONENONE

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 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

mnF3311UniqueIDUKIDMATH_NUMERICOPTNONE

This field is a unique number used to identify a record in a file.

szWorkcenterBranchWMCUcharOPTNONE

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 
(F41001).

Related Functions

B9800100 Get Audit Information

Related Tables

F3311 Capacity Message File
F3313 Capacity Load Table