Documentation >
MAC-PAC Technical Library >
Manufacturing >
Inventory Control >
Programs >
Component Requirements Generation - Purpose >
Component Requirements Generation - Calculations
Component Requirements Generation - Calculations
IC104E
A. Housekeeping
1. All work fields and program constants are initialized.
2. The four arrays, PNO, SEQ, QTY, and QTS that are used in the Component Requirement Generation are initialized.
a. PNO Used to save the part number of the parent part. If X = 1, where X represents the bill of material (BOM) level, PNO would be the order part. If X is greater than 1, PNO would be a build-thru part. If a part is at a level greater than 1, it must be a build-thru. The part number is saved to ensure the bill of material can be retraced to its original level once the generation of a build-thru's components begins.
b. SEQ Used to save the sequence level at which a build-thru part is encountered. This sequence level is saved to ensure the next part in the sequence is accessed when the lower level(s) explosion is completed.
c. QTY Used to save the calculated required quantity without Scrap Adjustment for the parent part. If X = 1, this value is the order quantity. If X is greater than 1, this value is the required parent quantity needed to satisfy the order. This is used to calculate the required quantity for the components of the parent part. The parent can be either the order part or a build-thru part.
d. QTS Used to save the calculated required quantity with scrap adjustment for build/through parent parts. If X is greater than 1, this value is the required parent quantity needed to satisfy the order and adjusted by the parent's scrap factor. This is used to calculate the required quantity with scrap adjustment for the components of build/through parts.
3. The Data Base Activity Flag (DBACT) is checked to verify the integrity of the data base. If the value is N, processing is terminated and the error code is returned to the calling programs for processing.
4. The parameter list links the Component Requirement Generation program with the calling program. The parameter list includes the fields discussed below. They must be passed in the following order:
|
|
|
|
CZJOB
|
The job number the M.O. is associated with.
|
X
|
|
CZORNO
|
The transaction order number.
|
X
|
|
CZPPN
|
The ordered part number for which the Component Requirements Generation is required.
|
X
|
|
CZORDQ
|
The requested order quantity for the ordered part.
|
X
|
|
CZTDT
|
The transaction date used to determine a part's effectivity.
|
X
|
|
CZDDT
|
The due date of a parent Manufacturing Order used to determine a part's effectivity.
|
X
|
|
CALCDE
|
The current plant's calendar code used when reading the Calendar file (CT140M).
|
X
|
|
PLANT
|
The plant against which the order is made.
|
X
|
|
CZCO
|
The transaction company written on transaction file records.
|
X
|
|
CWHNO
|
The transaction warehouse written on transaction file records
|
X
|
|
MODE
|
The program mode used to direct processing.
|
X
|
|
CRGEN
|
Used to return the status of the Component Requirements Generation. Valid values include:
|
|
X
|
|
END Generation successfully completed.
|
|
|
|
NOCOMP No effective components exist for the part.
|
|
|
|
NOACTV No active components (i.e. nonreference parts) exist for the part.
|
|
|
|
EXCPTN An abnormal end of job occurred.
|
|
|
|
OVERFL Required quantity exceeds its defined length. Processing terminated.
|
|
|
ERRCDE
|
Used to return any warnings or error conditions detected during processing.
|
|
X
|
CZHIQP
|
Used to return the highest Quantity of Component Per Parent value for an order part component. This value will be used by the calling program to detect an overflow condition.
|
|
X
|
WKNCMP
|
Used to return the number of active components generated for the order.
|
|
X
|
B. Mainline
OVERVIEW
1. The component requirement generation process explodes through the first level of an ordered part's product structure. If any of the level one components is a build-thru part, the explosion includes all of its components. A build-thru part of 99 levels can be maintained.
2. The component requirement generation process is controlled by the values of the Component Requirement Generation Status Code (CRGEN) and the Component Status Code (CMPSTC). The Generation Status Code controls the entire process. When its value changes, either an error has occurred or the generation completed successfully. The Component Status Code can change each time the Product Structure file (DE100M) is accessed. It indicates whether or not an effective component part exists for the parent part or if a component part is a build-thru part.
3. When the first component is found for the ordered part, the value EXPLOD is moved into the Component Requirement Generation Status Code (CRGEN). The part's explosion will continue until an abnormal end of job condition occurs, an overflow error occurs, or if the generation is successfully completed. The value of CRGEN is then changed to EXCPTN, OVERFL or END, respectively.
4. While the value of the Component Requirements Generation Status Code (CRGEN) remains EXPLOD, the value of the Component Status Code (CMPSTC) frequently changes. Valid values of the Component Status Code are:
BLDTRU The product structure record represents a build-thru part. Although the Component Requirement Transaction Record (IC100AP2) is not written for this component, its required quantity with and without scrap adjustment are saved to compute requirements for its components.
FOUND An effective record has been found on the Product Structure file (DE120M) and further component requirement processing is required.
NOT FND A search of the Product Structure file (DE120M) has resulted in no effective component or the end of the structure was reached.
An example of the generation process is provided below:
(1) In this example, A is the ordered part.
(2) The Product Structure file is accessed and component B is found. Because a component exists for this part, the value EXPLOD is moved to the Component Requirement Generation Status Code (CRGEN). Because component B is a build-thru part, BLDTRU is moved to the Component Status Code (CMPSTC).
(3) Once a build-thru part is encountered, its entire structure is compressed before returning to another level 1 component. In the example above, component E would be found before component G.
(4) The product structure is searched for components of parent B. Component C is found. Because it is a build-thru component, BLDTRU is moved to the Component Status Code (CMPSTC). The value of the Component Requirement Generation Status Code (CRGEN) is still EXPLOD.
(5) The Product Structure file is searched for components of parent C. Component D is found. It is not a build-thru so the value FOUND is moved to the Component Status Code (CMPSTC). The value of the Component Requirement Generation Status Code (CRGEN) is still EXPLOD.
(6) When the value of the Component Status Code (CMPSTC) = FOUND, that part is added as a component requirement for the order. The record is formatted and added to the Component Requirement Transaction file.
(7) After the addition of component D is made, the product structure of parent C is searched again. Component E is found. Component E is not a build-thru so the value of the Component Status Code (CMPSTC) is FOUND. The value of the Component Requirement Generation Status Code (CRGEN) is still EXPLOD.
(8) After the addition of component E is made, the product structure of parent C is searched again. At this point no more product structure records are found. The value of NOTFND is moved to the Component Status Code (CMPSTC). The value of the Component Generation Status Code (CRGEN) is still EXPLOD.
(9) The bottom of the structure for parent C has been reached. The generation now works its way back up to where B is now the parent.
(10) The product structure for parent B is searched again. Component F is found and added as previously described.
(11) After component F is added, the product structure for B is searched, and it is determined that the end of its structure has been reached. The generation is back to level 1, and the original order part A is now the parent.
(12) The product structure for parent A is searched. Component G is found and added as previously described.
(13) The product structure file is searched for other components of A. A search of the file produces the build-thru part, H. BLDTRU is moved to the Component Status Code (CMPSTC). The build-thru part is processed as previously discussed. Because components D and F were used elsewhere in the structure, additional processing must be performed to compress these multiple occurrences to a single occurrence.
(14) After processing component F, END is moved to the Component Requirement Generation Status Code (CRGEN). No other components exist for the ordered part. The generation has ended successfully.
5. This documentation is structured around the values of the Component Requirement Generation Status Code (CRGEN) and the Component Status Code (CMPSTC). Calculations and specific processing performed when each value is encountered are discussed.
C. CRGEN = EXPLOD
1. The Product Structure file (DE120M) is accessed to determine whether an effective component exists. If a record not found situation occurs, NOTFND is moved to the Component Status Code (CMPSTC).
2. The following steps are performed to determine if the component is effective:
a. If the Engineering Date In (PEFIN) and the Engineering Date Out (PEFOUT) are zero, the part is always effective.
b. If an effectivity date is entered for the part, the following relationships must exist:
(1) The Engineering Date In (PEFIN) is less than or equal to the passed Order Start Date (CZTDT)
and
(2) The passed Order Start Date (CZTDT) is less than or equal to the Engineering Date Out (PEFOUT).
3. If the part is effective, the Part Master file (DE100M) is accessed and the Part Type (MTYPN) is obtained.
4. If the part type is 4 (Planning), the part is not processed. Components are not generated for planning parts.
5. If the part type is 5 (Reference), FOUND is moved to the Component Status Code (CMPSTC). Reference parts are added as component requirements.
6. If PZREF = R and MTYPN 5, the component is ignored. Nonreference parts in a reference structure are not added to the Component Requirement Transaction file (IC100AP2).
7. If the part type is 6 (Build-thru), BLDTRU is moved to CMPSTC. FOUND is moved to CMPSTC for any other part type.
8. Depending on the value of CMPSTC determined above, processing continues and component requirements are generated.
D. CMPSTC = BLDTRU
1. The field BTCHK is initialized to N. This field indicates if a build-thru part has components.
2. The level-one Operation Number (RZOPNO) is saved. All duplicate components below this level will share this value.
3. The Required Quantity without Scrap Adjustment is calculated.
a. The Quantity of Component Per Batch field (PZQTY) is aligned into a numeric field with the appropriate decimal positions indicated by the Decimal Control Code (PSOCC).
b. The aligned Quantity of Component Per Batch is divided by the Product Structure Batch Quantity (PSBTQT) to obtain the Quantity of Component per Parent (MQP).
c. Order Quantity (CZORDQ) is multiplied by the Quantity of Component Per Parent (MQP) to obtain the Required Quantity (WKQTY). If X = 1, where X is the bill of material level;
(1)
|
CZORDQ
(Order Quantity)
|
times
|
MQP
(Quantity of Component Per Parent)
|
=
|
WKQTY
(Required Quantity without Scrap Adjustment)
|
d. If the component is at a level greater than 1, it is a build-thru part. Its Required Quantity without Scrap Adjustment is saved in the array (QTY,X). The saved value (QTYIN) is multiplied by the Quantity of Component Per Parent (MQP) to obtain the Required Quantity (WKQTY). If X is greater than 1;
(1)
|
QTYIN
(Saved Required Quantity without Scrap Adjustment)
|
times
|
MQP
(Quantity of Component Per Parent)
|
=
|
WKQTY
(Required Quantity without Scrap Adjustment)
|
4. The calculated Required Quantity without Scrap Adjustment (WKQTY) is validated as not being greater than 99,999,999.999.
5. The Required Quantity with Scrap Adjustment is calculated:
a. The Component Scrap Factor (PZSCRF) is formatted for calculations:
Calculated Scrap Factor (CALSCF) = Product Structure Scrap Factor (PZSCRF) divided by 100
b. Order Quantity (CZORDQ) is multiplied by the Quantity of Component Per Parent (MQP) and divided by 1 minus the Calculated Scrap Factor to obtain the Required Quantity with Scrap Adjustment (WKQTS). If X = 1, where X is the bill of material level;
(1) [CZORDQ (Order Quantity) times MQP (Quantity of Component Per Parent)] divided by [1 minus CALSCF (Calculated Scrap Factor)]
= WKQTS (Required Quantity with Scrap Adjustment)
c. If the component is at a level greater than 1, its Required Quantity for Scrap Adjustment is saved in the array (QTS,X). The saved value (QTYSCP) is multiplied by the Quantity of Component Per Parent (MQP) and divided by 1 minus the Calculated Scrap Factor to obtain the Required Quantity with Scrap Adjustment (WKQTS). If X is greater than 1;
(1) [QTYSCP (Saved Required with Scrap Adjustment) times MQP (Quantity of Component Per Parent)] divided by (1 minus CALSCF (Calculated Scrap Factor)]
= WKQTS (Required Quantity with Scrap Adjustment)
d. The calculated Required Quantity with Scrap Adjustment is validated as not being greater than 99,999,999.999.
6. If an overflow condition occurs, overflow processing is performed:
a. All records written to the Component Requirement Transaction file (IC100AP2) for the order part are deleted.
b. If the program was called by Manufacturing Order Maintenance program (IC102E) in the Asynchronous processing mode, the *ALL '9's record for the order is deleted.
c. The following parameter values are returned to the calling program with (WKQTS) and without (QTYOUT) scrap adjustment:
CRGEN = OVERFL
CZHIQP = 0
ERRCDE = MPC0425
d. The generation is terminated.
7. The array index, X, is incremented so processing will proceed to the next level of the bill of material. The Component Part Number (PZCPN), Sequence Number (PZSEQ), and Required Quantity are moved to the appropriate array positions. These values are saved to ensure the bill of material can be retraced to its original level after the build-thru components are processed.
8. The file pointer is positioned on the first record with the component Part Number now in array (PNO, X). The Product Structure file (DE120M) is accessed and all components for this part are processed. The Component Status Code (CMPSTC) is returned with one of the following values: BLDTRU, FOUND, NOTFND. Processing continues based on the value in this field.
E. CMPSTC = FOUND
1. The field CRCHK is initialized to Y. This field indicates if an effective component was found.
2. The Required Quantity without Scrap Adjustment is calculated.
3. The Quantity of Component Per Batch field (PZQTY) is aligned into a numeric field with the appropriate decimal positions indicated by the Decimal Control Code (PSOCC).
4. The aligned Quantity of Component Per Batch is divided by the Product Structure Batch Quantity (PSBTQT) to obtain the Quantity of Component Per Parent (MQP).
5. Order Quantity (CZORDQ) is multiplied by Quantity of Component Per Parent (MQP) to obtain the required quantity (WKQTY). If X = 1, where X is the bill of material level;
(1)
|
CZORDQ
(Order Quantity)
|
times
|
MQP
(Quantity of Component Parent)
|
=
|
WKQTY
(Required Quantity without Scrap Adjustment)
|
6. If the component is at a level greater than one, the part is a build-thru. Its Required Quantity without Scrap Adjustment is saved in the array (QTY, X). The saved Required Quantity value (QTYIN) is multiplied by the Quantity of Component Per Parent (MQP) to obtain the Required Quantity without Scrap Adjustment (WKQTY). If X is greater than 1;
(1)
|
QTYIN
(Saved Required Quantity without Scrap Adjustment)
|
times
|
MQP
(Quantity of Component Per Parent)
|
=
|
WKQTY
(Required Quantity without Scrap Adjustment)
|
7. The calculated Required Quantity (WKQTY) is validated as not being greater than 99,999,999.999.
8. The Required Quantity with Scrap Adjustment is calculated:
a. The Component Scrap Factor (PZSCRF) is formatted for calculations:
Calculated Scrap Factor (CALSCF) = Product Structure Scrap Factor (PZSCRF) divided by 100
b. Order Quantity (CZORDQ) is multiplied by the Quantity of Component Per Parent (MQP) and divided by 1 minus the Calculated Scrap Factor to obtain the Required Quantity with Scrap Adjustment (WKQTS). If X = 1, where X is the bill of material level;
(1) [CZORDQ (Order Quantity) times MQP (Quantity of Component Per Parent)] divided by [1 minus CALSCF (Calculated Scrap Factor)]
= WKQTS (Required Quantity with Scrap Adjustment)
c. If the component is at a level greater than 1, its Required Quantity for Scrap Adjustment is saved in the array (QTS,X). The saved value (QTYSCP) is multiplied by the Quantity of Component Per Parent (MQP) and divided by 1 minus the Calculated Scrap Factor to obtain the Required Quantity with Scrap Adjustment (WKQTS). If X is greater than 1;
(1) [QTYSCP (Saved Required with Scrap Adjustment) times MQP (Quantity of Component Per Parent)] divided by (1 minus CALSCF (Calculated Scrap Factor)]
= WKQTS (Required Quantity with Scrap Adjustment)
d. The calculated Required Quantity with Scrap Adjustment is validated as not being greater than 99,999,999.999.
9. If an overflow condition occurs, overflow processing is performed:
a. All records written to the Component Requirement Transaction file (IC100AP2) for the ordered part are deleted.
b. If the program was called by Manufacturing Order Maintenance program (IC102E) in the Asynchronous processing mode, the *ALL '9's record for the order is deleted.
c. The following parameter values are returned to the calling program:
(1) CRGEN = OVERFL
(2) CZHIQP = 0
(3) ERRCDE = MPC0425
d. The generation is terminated.
10. The array index, X, is incremented with (WKQTS) and without (QTYOUT) scrap adjustment so processing will proceed to the next level of the bill of material. The component Part Number (PZCPN), Sequence Number (PZSEQ), and Required Quantity are moved to the appropriate array positions. These values are saved to ensure the bill of material can be retraced to its original level after the build-thru components are processed.
11. The Quantity of Component Per Parent is calculated.
a. The Product Structure (PZQTY) at level-one of the bill of material is used.
b. The Quantity of Component Per Parent is calculated when X is greater than 1. The Required Quantity work field (WKRQTY) is divided by the Order Quantity work field (WKORDQ) to obtain the average Quantity of Component Per Parent value. The result is placed in a numeric field with the appropriate decimal positions: XDECO, XDEC1, XDEC2, XDEC3, XDEC4, XDEC5, XDEC6, or XDEC7, where the last digit represents the number of decimal positions. This value is also placed in a high Quantity of Component Per Parent work field (WKH1QP).
12. The Component Requirement Transaction file (IC100AP2) is accessed to retrieve the Component Requirement Record. If no record is found, a record is formatted and added to the file.
13. Duplicate add processing is performed if a record already exists for the component. This implies the component was used elsewhere in the structure. Multiple occurrences of the component is compressed to a single occurrence.
a. The posted Transaction Quantity of Component Per Parent (CZQTY), Decimal Control Code (CDDCC), Required Quantity with (CZQQTY) and without (CZQWOS) scrap adjustment, and Operation Number (CZOPNO) are moved to existing value work fields. These fields can be updated.
b. The new Required Quantity without Scrap Adjustment (CALQTY) is calculated by adding the Transaction Record value (WKRQTY) to the existing value (EXRQTY). The result is placed in (WKRQTY) and overflow is monitored for.
c. The new Required Quantity with Scrap Adjustment (CALQTS) is calculated by adding the Transaction Record value (WKRQTS) to the existing value (EXRQTS). The result is placed in (WKRQTS) and overflow is monitored for.
d. If an overflow condition did not occur, duplicate add processing continues. Otherwise, overflow processing is performed and the generation is terminated.
e. The Average Quantity of Component Per Parent is calculated by dividing the new Required Quantity (WKRQTY) by the Manufacturing Order Quantity (WKORDQ). The new decimal control code is determined by eliminating insignificant zeros to the right of the Average Quantity per decimal point.
f. The Average Scrap Factor (AVGSCF) is calculated as follows:
AVGSCF (Average Scrap Factor) = 1 minus [WKRQTY (Required Quantity without Scrap Adjustment) divided by WKRQTS (Required Quantity with Scrap Adjustment)]
g. The Required Quantity with Scrap Adjustment is recalculated using the Average Scrap Factor and overflow is monitored.
h. The High Quantity Per (WKHIQP) is calculated by dividing the Transaction Quantity Per (WKAQP) by 1 minus the Average Scrap Factor. If any overflow occurs, the High Quantity Per field is set to a value of all '9's.
14. The recalculated values of Quantity of Component Per Parent (WKUQTY), Decimal Control Code (WKDCC), and Required Quantity with (WKRQTS) and without (WKRQTY) scrap adjustment are moved to the Transaction file (IC100AP2) fields.
15. The highest Operation Number is posted. The operation number at level one is greater than the operation number at levels where X is greater than 1.
16. The Component Requirement Transaction file (IC100AP2) is updated.
17. The highest Quantity of Component Per Parent is determined. This value is saved and returned to the calling program.
F. CMPSTC = NOTFND
1. NOTFND occurs in either of the following situations:
a. No effective components exist for the parent.
b. The generation has been completed.
2. If CRCHK = N, no effective components were found for the ordered part, and a critical error has occurred.
3. If no effective components were found for a build-thru part, a warning condition has occurred.
4. The product structure file pointer is reset once a NOTFND condition has occurred for a build-thru part. The current level sequence is moved to PSKEY. X is decremented by one. The parent Part Number at level X (PNO,X) is moved to PSKEY. The file pointer is positioned one level higher.
5. END is moved to the Component Requirement Generation Status Code (CRGEN) if the bill of material level 1 and CRCHK = Y. This indicates components did exist for the ordered part and the generation has completed.
G. CRGEN = NOCOMP
NOCOMP is moved to the Component Requirement Generation Status Code (CRGEN) if no effective components were found during the generation. A component may exist for the order part; however, if it is not effective, the generation ignores it. This is a critical error and processing is terminated.
H. CRGEN = OVERFL
OVERFL is moved to the Component Requirement Generation Status Code (CRGEN) when the calculated Required Quantity (WKRQTY) is greater than 99,999,999.999. This is a critical error and overflow processing is performed.
I. CRGEN = EXCPTN
EXCPTN is moved to the Component Requirement Generation Status Code (CRGEN) if a file error has occurred. File exceptions and other I/O processing errors forces processing to terminate.
J. CRGEN = END
END is moved to the Component Requirement Generation Status Code (CRGEN) once the components requirement generation has been completed successfully.