CacheProcessMRPBucketlessDates

Cache, Process MRP Bucketless Dates

Major Business Rule

Object Name: B3401270

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose

This function will perform Get, Add, Update, Delete, Delete All, Get Next, Add/Update, and Terminate 

functions on the MRP Bucketless Date Cache used in the MRP/MPS planning programs (P3482 and P3483).


The calling functions are responsible for loading all appropriate key values to the data structure 

and identifying the number of keys to use in retrieval/update processes.


1.2 Setup Notes and Prerequisites
• Cache Action Codes
• 

'1' Get - retrieve the cache element.
• '2' Add - add a cache element.
• '3' Update - update a cache element.
• '4' Delete - delete a cache element.
• '5' Delete All - delete all cache elements
• '6' Get Next - retrieve the next cache element
• '7' Add/Update - will add if element does not exist, will change if it does exist.
• '8' Terminate - terminate cache
• '9' Release Cursor - close the input cursor
• 'N' Get Nearest - Retrieve the cache element matching the input Branch and Date.  If the element 
does not exist, retrieve the element with the date immediately before or after based on the input 

Camparison Flag.

•  'D' Debug Mode - Dumps the contents of the entire cache into a text file.
'b7'b7
• Number of Keys 
• 
If the number of keys is passed as a parameter, the business function uses this value to setup 
key values for a Get, Update, Delete, Get Next, and Add/Update.

• A zero may be passed to retrieve, update, or delete the first record.
'b7'b7
• When action code GET is used, the function saves the cache cursor pointer if the fetch is successful 
and SequentialFetch = '1'.  This allows the calling application to use GET NEXT to fetch elements 

from the cache sequentially.  If GET NEXT is called until the end of the keyed cache dataset is found, 

the function automatically closes the open cursor.  Otherwise, the calling application is responsible 

for closing the cursor using action code '9'.

'b7'b71.3Special Logic

This function creates a unique cache for each Parts List process.  The function appends the input Job 

Number string to the function name 'B3100650-' to build the cache name used for the calling 

application.


2.Technical Specifications

I.Perform setup functions 

A.Initialize cache to get handle.
B.If not successful, set error "032E", set Cache Error Code = '3', and return failure.

C.Validate input parameters Number Of Keys, Action Code, and Comparison Flag.

D.If not valid, set error "032E", set Cache Error Code = '2', and return failure.

E.Set Cache Error Code = '0'

F.Set return code to success.


II.Processing Based on Mode.


A.If Cache Action Code is '1' - GET:
1.Open cursor.  If the input Cursor Pointer is not NULL, retrieve the existing cursor and reset 
it.

2.Retrieve the first element on the cache matching the key values passed as input.  If the input 

Number of Keys is zero, fetch the first element in the cache.

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

calling program.

4.If SequentialFetch = '1', return cursor pointer to calling application.  Otherwise, close the 

cursor.

5.If get fails set Cache Error Code = '6'.


B.If Cache Action Code is '2' - ADD:
1.Insert a new cache element with values from data structure.
2.If add fails set error "032E", set Cache Error Code = '4', and return failure.


C.If Cache Action Code is '3' - UPDATE:
1.Update existing cache element with values from data structure.
2.If update fails set error "032E", set Cache Error Code = '4', and return failure.


D.If Cache Action Code is '4' - DELETE:
1.If the Number of Keys is not 0, delete all elements in the cache matching the key values passed 
as input.

2.If the number of keys is 0, delete the first cache element.

3.If delete fails, set Cache Error Code = '5'.


E.If Cache Action Code is '5' - DELETE ALL:

1.Delete all elements in the cache.
2.If delete fails, set Cache Error Code = '5'.


F.If Cache Action Code is '6' - GET NEXT:
1.Using the input cursor pointer from the previous GET action, retrieve the next element in 
the cache matching the key values passed as input (the cursor should have been set through a 

previous "Get" action, i.e. action code '1'.  If the Number of Keys is zero then fetch the 

next record without using any key).

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

the calling program.

3.If there are no more elements, close the cursor and set Cache Error Code = '1'.


G.If Cache Action Code is '7' - ADD/UPDATE:

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

3.If add fails set error "032E", set Cache Error Code = '4', and return failure.


H.If Cache Action Code is '8' - END
1.If the input CacheCursorPtr is not zero, retrieve the pointer and close the cursor.
2.Perform cleanup functions (Terminate cache).


I.If Cache Action Code is '9' - CLOSE CURSOR:
1.Retrieve the Data Ptr (Cache Cursor Ptr must not be Zero).
2.Close cursor.

3.Free Data Ptr and Set Cache Cursor Ptr to 0.


J.If Cache Action Code is 'N' - GET NEAREST:
1.Open cursor.
2.Retrieve the first element in the cache matching the key values passed as input.  The input 

Number of Keys must be 2.

3.If successful, load the values from the retrieved element into the data structure to be passed 

back to the calling program and return success.

4.If not successful, Reset cursor.

5.Using just the input Branch as the key, search for the cache element with the desired date 

based on the input Direction Flag:

'B' = retrieve the cache element occurring just before the input Date
'A' = retrieve the cache element occurring just after the input Date

6.Load the values from the retrieved element into the data structure to be passed back to the 
calling program.

7.If get fails set Cache Error Code = '6'.


Data Structure

D3401270 - Cache, Process MRP Bucketless Dates


Data Item Data Structure DescriptionI/ORequiredNotes

JOB            Job Number                        IY      Job Number as string for 

cache name

MCU            Branch                        I/OY      Key value

DRQJ             Date                              I/OY      Key value

EV01            Bucket Flag                   OY

EV02            Week/Month End Flag            OY

EV03            Forecast Consumption Flag      OY

MTF1            Work Days in Week                  OY

MTF2            Work Days in Month            OY

FTRP            Feature Percent                  OY

EV01            Comparison Flag                  I      Only used for action code 

'9': 

                                                                        'B' = get cache element 

w/Date <= 

                                                                              input date 

                                                                        'A' = get cache element 

w/Date >= 

                                                                              input date

EV01            Cache Action Code                  IY      '1' = Get cache element 

                                                                        '2' = Add element  

                                                                        '3' = Update element 

                                                                        '4' = Delete cache elements 

                                                                        '5' = Delete All cache 

elements 

                                                                        '6' = Get Next cache element 

                                                                        '7'  = Add/Update cache 

element 

                                                                        '8' = End cache (terminate 

cache) 

                                                                        '9' = Close Cursor and Free 

Ptr 

                                                                        'N' = Get Nearest 

                                                                        'D' = Debug Mode

EV01            Cache Error Code                  ON      '0' = Success Process 

                                                                        '1' = Reached End of 

Cache(mode 6)                                                                         

                                                                        '2' = Invalid Input Parameter 


                                                                        '3' = Failed to Create Cache 

                                                                        '4' = Failed to Add/Update 

Cache 

                                                                        '5' = Failed to Delete Cache 

                                                                        '6' = Fetch Failed(mode 1 or 

9)

INT01            Number of Keys                      IY      Number of Keys to be used in 

the 

                                                                        cache process.

SUPPS            Suppress Error Message              IN      '0'= allow runtime error 

message 

                                                                             handling. 

                                                                        '1'= Suppress runtime error 

message 

                                                                             handling.

DTAI            Error Message Id                  ON      " " = Success 

                                                                        "032E" = Error Processing 

Cache

GENLNG         Cache Cursor Ptr                  I/ON

EV02            Sequential Fetch                  I/ON      If action is GET and this 

parm is 

                                                                        '1', function will pass back 

cursor 

                                                                        pointer for GET NEXT 

operation.



^

Parameter NameData ItemData TypeReq/OptI/O/Both
szJobNumberJOBcharNONENONE

Job Number

szBranchMCUcharNONENONE

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.

jdDateDRQJJDEDATENONENONE

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

cBucketFlagEV01charNONENONE

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

cWeekMonthEndFlagEV02charNONENONE

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

cForecastConsumptionFlagEV03charNONENONE

A radio button that specifies the level at which trace/track result is to be displayed.  Select the Detail to display all transactions except IB, IX, 
and IZ types.  Or, select Derivative Lots Only to display only those transactions that may have created new derivative lot. 

mnWorkDaysInWeekMTF1MATH_NUMERICNONENONE

The number of days that the system uses in conjunction with the time fence rule to determine how the forecast is used. Enter the number of 
days after the start date when the time fence rule changes from the first rule to the second rule. For example, if the time fence rule is S (customer 
demand before the time fence, forecast after the time fence), the generation start date is 01/03/05,and the planning time fence is 3 days, the 
system plans using customer demand through 01/06/05. Beginning on 01/07/05, the system plans using the forecast. Note that:     o The 
system does not count the generation start date; that is, the day after the generation start date is day 1.     o For manufactured items, the system 
counts working days, as defined in the Shop Floor Calendar.     o For purchased items, the system counts calendar days.

mnWorkDaysInMonthMTF2MATH_NUMERICNONENONE

The number of days from the generation start date within which the system does not generate action messages. For example, if the 
generation start date is 01/03/05, and the freeze time fence is 3 days, the planning system does not generate messages with required dates that are 
less than or equal to 01/06/05. Note: o The system does not count the generation start date; that is, the day after the generation start date is 
day 1. o For manufactured items, the system counts working days, as defined in the shop floor calendar. o For purchased items, the system 
counts calendar days.

mnFeaturePercentFTRPMATH_NUMERICNONENONE

The percentage of demand for a specified feature based on projected production. For example, a company might produce 65% of their 
lubricant with high viscosity, and 35% with low viscosity, based on customer demand. The Material Planning system uses this percentage to 
accurately plan for a process's co-products and by-products. Enter percentages as whole numbers, for example, enter 5% as 5.0. The default 
value is 0%.

cComparisonFlagEV04charNONENONE

PeopleSoft event point processing flag 04.

cCacheActionCodeEV05charNONENONE

A flag that indicates whether automatic spell check is turned on.

cCacheErrorCodeEV06charNONENONE

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

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.

nNumberOfKeysINT01integerNONENONE

Number of Days in Future to Query for Responses Due. 

idCacheCursorPtrGENLNGIDNONENONE

General purpose ID variable.

cSequentialFetchEV07charNONENONE

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

Related Functions

None

Related Tables

None