CacheCoByProductCompletion

Cache Co/By Product Completion

Major Business Rule

Object Name: B3101570

Parent DLL: CMFGBASE

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose


B3101570, Cache Process Co/By Completions performs the cache handling activity used to maintain co/by 

completions.  This includes: initialize, add, update, delete, get, etc. The parameter Cache Action 

Code contains the value that determines what cache operation(s) are to be performed during the specific 

call.


1.2Setup Notes and Prerequisites


None.


1.3Special Logic


When using Cache Action Code mode '6' processing (Get Next), it is necessary to maintain the returned 

cursor value and pass that value back to subsequent mode '6' calls. 


2.Technical Specifications


2.4Processing 


If iCacheActionCode == CACHE_GET
1.Open cursor, reset cursor.
2.Retrieve the first element on the cache matching the key values passed as input; the 

number of keys to be used is passed in the input parameters,  If  "0" fetch first element in the 

list.

3.Check to see if the keys change. 

4.Load the values from the retrieved element into the data structure to be passed back to 

the calling program.

5.If get fails return failure.



If iCacheActionCode == CACHE_ADD
1.Insert a new cache element with values from data structure.
2.If add fails set error "032E"(Error Processing Cache) and return failure.



If iCacheActionCode == CACHE_UPDATE
1.Update existing cache element with values from data structure.
2.If update fails set error "032E" (Error Processing Cache)  and return failure.



If iCacheActionCode == CACHE_DELETE
1. If the number of keys is 0, Delete all elements in the cache.
2. If the number of keys is not 0, Delete the first cache element matching the key values 

passed as input. 

3. If delete fails, return failure.



If iCacheActionCode == CACHE_DELETE_ALL
3.Delete all elements on the cache equal to the partial key provided. 
4.If delete fails, return failure;



If iCacheActionCode == CACHE_GET_NEXT
1.Retrieve the next element on the cache matching the key values passed as input 
• 
the first GetNext will establish the cursor
• subsequent GetNext operations require the cursor to be sent as a parameter, otherwise the 
GetNext will re-establish the cursor to the initial record in the key.

• if number of keys is "0" then fetch next record with out using any key 
2.Check to see if the keys change.
3.Load the values from the retrieved element into the data structure to be passed back to 

the calling program and return the cursor value.

4.If there are no more elements close cursor and return failure.



If iCacheActionCode == CACHE_ADD_UPDATE
1.Delete Record , if one exists,  that matches full key from Input.
2.Insert a new cache element with values from data structure.

3.If add fails set error "032E" (Error Processing Cache) and return failure.



If iCacheActionCode == CACHE_END
1.Perform cleanup functions (Terminate cache).

Data Structure

D3101570 - Cache Co/By Product Completion

Data Item   Data Structure Description   I/O  Required     Notes
CACTN      Cache Action Code           I    Yes  '1' - Get 

                                                        '2' - Add 

                                                        '3' - Update 

                                                        '4' - Delete 

                                                        '5' - Delete All 

                                                        '6' - Get Next 

                                                        '7' - Add/Update 

                                                        '8' - End Cache 

                                                        '9' - Close Cursor

NKEYS      Number of Keys           I            The input parameter Number 

                                                        of Keys is required for 

                                                        processing when using 

                                                        Cache Action Code value 

                                                        equal to '1', '2', '3', 

                                                        '4', '5', '6', and mode 

                                                        '7'. Cache Action Code 

                                                        values '8' and '9' do not 

                                                        require Number of Keys to 

                                                        be entered. 

EV01      Suppress Error Message     I    No  '1' suppresses error 

                                                        messages

DTAI      Error Message ID           O

GENLNGCache Cursor           I/O          Required for Cache Action 

                                                        Code '6'

JOBS      Job Number                 I/O  Yes  Job Number should always 

                                                        the first field within 

                                                        each cache's index

SEQ      Sequence Number           I/O  Yes  Index field

NUMR      Record Number           I/O  Yes  Index field

ITM      Short Item Number           I/O

CMCU      Component Branch

LOCN      Location                 I/O

LOTN      LotSN                       I/O

MTST      Material Status Code     I/O

LOTS      Lot Status Code           I/O

LOTG      Lot Grade                 I/O

LOTP      Lot Potency                 I/O

UORG      Quantity Ordered           I/O

SOQS      Quantity Completed     I/O

SOCN      Quantity Scrapped           I/O

UOM      Unit of Measure as Input     I/O

STRX      Completion Date           I/O

DRQJ      Request Date           I/O

OPSQ      Operation Sequence     I/O

QT2      Transaction Quantity     I/O

CPCN      Quantity Scrap Variance     I/O

UM      Unit Of Measure           I/O  

COBY      CoBy Product            I/O

RSCP      Resource Percent           I/O

RCD      Reason Code                 I/O

ACTI      Saved Action Code           I/O

LOT1        Memo Lot 1                   I/O  No

LOT2        Memo Lot 2                   I/O  No

^

Parameter NameData ItemData TypeReq/OptI/O/Both
szCacheActionCodeCACTNcharOPTNONE

A code that indicates the activity you want to perform. Valid codes:     o Get - Retrieve the cache element     o Add - Add a cache element     o 
Update - Update a cache element     o Delete - Delete a cache element     o Delete All - Delete all cache elements     o Get Next - Retrieve the 
next cache element     o Add/Update - Add a cache element if it does not exist; Update a cache element if it does exist     o Terminate - 
Terminate Cache

mnNumberKeysNKEYSMATH_NUMERICOPTNONE

The number of keys in an index that will be used to retrieve, delete, or update a record.

cSuppressErrorMessageEV01charOPTNONE

An option that specifies the type of processing for an event.

szErrorMessageIDDTAIcharOPTNONE

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.

idCacheCursorGENLNGIDOPTNONE

General purpose ID variable.

mnJobNumberJOBSMATH_NUMERICOPTNONE

The job number (work station ID) which executed the particular job.

mnSequenceNumberSEQMATH_NUMERICOPTNONE

A number that specifies the sequence of information.

mnRecordNumberNUMRMATH_NUMERICOPTNONE

The equipment number or work order number associated with a change of status.

mnShortItemNumberITMMATH_NUMERICOPTNONE

An inventory item number. The system provides three separate item numbers plus an extensive cross-reference capability to other item 
numbers (see data item XRT) to accommodate substitute item numbers, replacements, bar codes, customer numbers, supplier numbers, and 
so forth. The item numbers are as follows:   o Item Number (short) - An eight-digit, computer-assigned item number     o 2nd Item Number - The 
25-digit, free-form, user defined alphanumeric item number     o 3rd Item Number - Another 25-digit, free-form, user defined alphanumeric item 
number

szBranchComponentCMCUcharOPTNONE

A secondary or lower-level business unit. The system uses the value that you enter to indicate that a branch or plant contains several 
subordinate departments or jobs. For example, assume that the component branch is named MMCU. The structure of MMCU might be as follows:    
Branch/Plant - (MMCU)       Dept A - (MCU)       Dept B - (MCU)       Job 123 - (MCU)

szLocationLOCNcharOPTNONE

The storage location from which goods will be moved.

szLotSNLOTNcharOPTNONE

A number that identifies a lot or a serial number. A lot is a group of items with similar characteristics.

szMaterialStatusCodeMTSTcharOPTNONE

A user defined code (31/MS) that identifies the current status of a particular component on the work order.

cLotStatusCodeLOTScharOPTNONE

A user defined code (41/L) that indicates the status of the lot. If you leave this field blank, it indicates that the lot is approved. All other codes 
indicate that the lot is on hold. You can assign a different status code to each location in which a lot resides on Item/Location Information or 
Location Lot Status Change.

szLotGradeLOTGcharOPTNONE

A code that indicates the grade of a lot. The grade is used to indicate the quality of the lot. Examples include the following:    A1   Premium 
grade    A2   Secondary grade  The grade for a lot is stored in the Lot Master table (F4108).

mnLotPotencyLOTPMATH_NUMERICOPTNONE

A code that indicates the potency of the lot expressed as a percentage of active or useful material (for example, the percentage of alcohol 
in a solution). The actual potency of a lot is defined in the Lot Master table (F4108).

mnQuantityOrderedUORGMATH_NUMERICOPTNONE

The quantity of units affected by this transaction.

mnQuantityCompletedSOQSMATH_NUMERICOPTNONE

The number of units committed for shipment in Sales Order Entry, using either the entered or the primary unit of measure defined for this 
item. In the Manufacturing system and Work Order Time Entry, this field can indicate completed or scrapped quantities. The quantity type is 
determined by the type code entered.

mnQuantityScrappedSOCNMATH_NUMERICOPTNONE

The number of units canceled in Sales Order or Work Order Processing, using either the entered or the primary unit of measure defined for 
this item. In manufacturing, this can also be the number of units scrapped to date.

szUnitOfMeasureAsInputUOMcharOPTNONE

A user defined code (00/UM) that indicates the quantity in which to express an inventory item, for example, CS (case) or BX (box).

jdCompletionDateSTRXJDEDATEOPTNONE

The date that the work order or engineering change order is completed or canceled.

jdRequestedDateDRQJJDEDATEOPTNONE

The date that an item is scheduled to arrive or that an action is scheduled for completion.

mnOperationSequenceOPSQMATH_NUMERICOPTNONE

A number used to indicate an order of succession. In routing instructions, a number that sequences the fabrication or assembly steps in the 
manufacture of an item. You can track costs and charge time by operation. In bills of material, a number that designates the routing step in the 
fabrication or assembly process that requires a specified component part. You define the operation sequence after you create the routing 
instructions for the item. The Shop Floor Management system uses this number in the backflush/preflush by operation process. In engineering 
change orders, a number that sequences the assembly steps for the engineering change. For repetitive manufacturing, a number that 
identifies the sequence in which an item is scheduled to be produced. Skip To fields allow you to enter an operation sequence that you want to begin 
the display of information. You can use decimals to add steps between existing steps. For example, use 12.5 to add a step between steps 
12 and 13.

mnTransactionQuantityQT2MATH_NUMERICOPTNONE

Generic Quantity field.

mnQuantityScrapVairanceCPCNMATH_NUMERICOPTNONE

The difference between the original Sales Order cancel amount and the new calculated Sales Order cancel quantity. This field maintains 
the 'net change'in an order line's cancel quantity during inventory processing.

szUnitOfMeasureUMcharOPTNONE

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.

cCoByProductCOBYcharOPTNONE

A code that distinguishes standard components or ingredients from co-products,by-products, and intermediates. Co-products are 
(concurrent) end items as the result of a process. By-products are items that can be produced at any step of a process, but were not planned. 
Intermediate products are items defined as a result of a step but are automatically consumed in the following step. Generally, intermediates are 
nonstock items and are only defined steps with a pay-point for reporting purposes. Standard components (Discrete Manufacturing) or ingredients 
(Process Manufacturing) are consumed during the production process. Valid values are:    C Co-products    B By-products    I Intermediate 
products    Blank Standard components or ingredients

mnResourcePercentRSCPMATH_NUMERICOPTNONE

A number that indicates what percent of the ingredients should be issued separately to co-products and by-products.

szReasonCodeRCDcharOPTNONE

A user defined code (42/RC) that explains the purpose for a transaction. For example, you can indicate the reason that you are returning 
items.

cActionCodeACTIcharOPTNONE

A code that indicates the activity you want to perform.  Valid codes are:    A Add    C Change    I Inquire    D Delete    .     End the program    Blank 
Clear the screen  NOTE: Depending on how your company has set up action code security, you may not be authorized to use all action 
codes.

szMemoLot1LOT1charOPTNONE

A higher classification or grouping of serial number or lot processed items,maintained within the Lot Master (F4108).

szMemoLot2LOT2charOPTNONE

A higher classification or grouping of memo lot 1 maintained within the lot master (F4108).

szLocationFileFormatLOCNcharOPTNONE

The storage location from which goods will be moved.

jdLotExpirationDateMMEJJDEDATEOPTNONE

The date on which a lot of items expires. The system automatically enters this date if you have specified the shelf life days for the item on 
Item Master Information or Item Branch/Plant Information. The system calculates the expiration date by adding the number of shelf life days to 
the date that you receive the item. You can commit inventory based on the lot expiration date for items. You choose how the system commits 
inventory for an item on Item Master Information or Item Branch/Plant Information.

szSecondaryUnitOfMeasureUOM2charOPTNONE

A user defined code (00/UM) that indicates an alternate unit of measure for the item.

mnSecondaryCompletedQtySSTQMATH_NUMERICOPTNONE

The number of units, expressed in the secondary unit of measure, that the system has recorded as completed or issued. This value can 
represent either the quantity completed for co-/by-products or the quantity that was issued for a component.

mnSecCompletedToDateSSTQMATH_NUMERICOPTNONE

The number of units, expressed in the secondary unit of measure, that the system has recorded as completed or issued. This value can 
represent either the quantity completed for co-/by-products or the quantity that was issued for a component.

cDualUnitOfMeasureItemDUALcharOPTNONE

An option that indicates that the system must maintain inventory balances and record transactions for an item in a secondary unit of 
measure that does not have a fixed conversion to the primary unit of measure. Typically, you choose this option when the item is ordered or sold by 
a packaged quantity and priced by weight or volume. Note: For a dual unit of measure item, the system might require a tolerance check for 
inventory transactions (excluding inventory adjustments) between the primary unit of measure and the secondary unit of measure.

jdLotEffectiveDateDLEJJDEDATEOPTNONE

The date on which a lot becomes available. The system uses this date for availability and commitment processing to indicate that the lot is 
available on or after the date that you specify. You must complete this field when inventory first becomes an on-hand quantity for the lot. If you 
leave this field blank, the system calculates the effective date of the lot by using the value for Effective Days in the Item Branch File table 
(F4102) or the current date if the value for Effective Days is zero.

jdSellByDateSBDJJDEDATEOPTNONE

The date by which a lot should be completely sold. The system uses this date as a "through" date for commitment processing. The system 
calculates the sell by date using the value in the Sell By Days field, which is contained in the Item Branch File table (F4102), when inventory 
becomes available on-hand.

jdBestBeforeDateBBDJJDEDATEOPTNONE

The last date on which the products in a lot should be consumed. The system calculates the date by retrieving the value from the Best 
Before Days field in the Item Master program (P4101). You can also use this date as a "through" date for commitment processing. You can 
commit a lot by this date by using the Commitment Date Method field in the Item Branch program (P41026).

jdBasedOnDateBODJJDEDATEOPTNONE

The date that the system uses in conjunction with the shelf life days to calculate the lot expiration date. You can enter this date during 
inventory completions. In addition to calculating the lot expiration date, the system uses the date that you enter in this field to calculate the following 
lot dates:   o Sell By Date   o Best Before Date   o Lot Effectivity Date   o User Lot Date 1   o User Lot Date 2   o User Lot Date 3   o User Lot Date 
4   o User Lot Date 5

jdUserLotDate1U1DJJDEDATEOPTNONE

A date that the system can use as a through date for commitment processing. The system stores this date in the Lot Master table (F4108). If 
you leave this field blank, the system can calculate the date by using the value for the User Lot Date 1 Default Days field, which is stored in 
the Item Branch File table (F4102).

jdUserLotDate2U2DJJDEDATEOPTNONE

A user-defined date that can be used for commitment purposes and is stored in the Lot Master table (F4108). Similar to the Lot Expiration 
Date, User Lot Date 2 is a through date for commitment processing. The User Lot Date 2 commitment option is available in the Commitment 
Date Method in the Item Branch table (F4102). The system uses the User Lot Date 2 Default Days from the Item Branch table (F4102) to 
calculate User Lot Date 2 when inventory first goes on hand.

jdUserLotDate3U3DJJDEDATEOPTNONE

A user-defined date that can be used for commitment purposes and is stored in the Lot Master table (F4108). Similar to Lot Expiration Date, 
User Lot Date 3 is a through date for commitment processing. The User Lot Date commitment option is available in the Commitment Date 
Method in the Item Branch table (F4102). The system uses the User Lot Date 3 Default Days from the Item Branch table (F4102) to calculate User 
Lot Date 3 when inventory first goes on hand.   

jdUserLotDate4U4DJJDEDATEOPTNONE

A user-defined date that can be used for commitment purposes and is stored in the Lot Master table (F4108). Similar to Lot Expiration Date, 
User Lot Date 4 is a through date for commitment processing.   The User Lot Date commitment option is available in the Commitment Date 
Method in the Item Branch table (F4102). The system uses the User Lot Date 4 Default Days from the Item Branch table (F4102) to calculate 
User Lot Date 4 when inventory first goes on hand.

jdUserLotDate5U5DJJDEDATEOPTNONE

A user-defined date that can be used for commitment purposes and is stored in the Lot Master table (F4108). Similar to Lot Expiration Date, 
User Lot Date 5 is a through date for commitment processing.   The User Lot Date 5 commitment option is available in the Commitment Date 
Method in the Item Branch table (F4102). The system uses the User Lot Date 5 Default Days from the Item Branch table (F4102) to calculate 
User Lot Date 5 when inventory first goes on hand.

Related Functions

None

Related Tables

None