1.Functional Description
1.1Purpose
This function will use a secondary date cache to determine work days between two dates - the Input
DATE01 and the Type 2 date in the D2 cache. This function is used only in the MRP/MPS planning programs
(P3482 and P3483).
The calling application is 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
Function Action Codes
'R' Return Work Days, build the cache if necessary.
'T' Terminate - terminate/destroy cache and its contents.
'X' Delete - Delete all records in the cache.
'D' Debug Mode - Dumps the contents of the entire cache into a text file.
Number of Keys
key values for a Get.
A zero may be passed to retrieve the first record.
This function creates a unique cache for each MRP/MPS planning process. The function appends the
input Job Number string to the two character ID 'D2' to build the cache name used for the calling
application.
2.Technical Specifications
Cache Layout:Cache includes all of the following fields; key fields are noted.
Data Item Data Structure DescriptionKey Field
MCUBranchY
INTType'1' - Normal Work Date
'2' - First Work Day
'3' - Smallest Work Day
in CacheY
DRQJDateY
I.Perform setup functions
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.
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 get fails set Cache Error Code = '2'.
5.Close cursor
2.Fetch from Cache with Input MCU, and Type = 2. Store date in Wk FirstWD
3.Fetch from Cache with Input MCU, and Type = 3. Store date in Wk SmallestWD.
4.If Input DATE01 < Wk SmallestWD
5.Load Work Days from F0007 starting with month, year of Input DATE01 to Wk FirstWD.
6.Call Internal Routine to Calculate Work Days.
7.Else
8.Call Internal Routine to Calculate Work Days.
9.End If
10.Close cursor
11.Return Work Days to Output Parm Work Days.
Calculate Work Days(*WkNumDays)
If Failed then
Find first date in the cache >= Input DATE01.
*WkNumDays++
While (Date <> Wk FirstWD)
FetchNext with Input MCU and Type = 1
If Date <> Wk FirstWD and Fetch Succeeded
WkNumDays++
End If
End While
Else
While (Date <> Wk FirstWD)
FetchNext with Input MCU and Type = 1
If Date <> Wk FirstWD and Fetch Succeeded
*Wk NumDays++
End If
End While
End If
2.Fetch all records in the cache and dump contents to a text file.
D3401340 - MRP, Return Work Days
Data Item Data Structure DescriptionI/ORequiredNotes
JOB Job Number IY Job Number as string for
cache name
MCU Branch I/OY Key value
INT Type I/OY Key value
DRQJ Date I/OY Key value
DATE01 Start Date I Required when Action Code 'R'
INT Work Days O Required when Action Code 'R'
EV01 Action Code IY 'G' = Get cache element
'I' = Insert cache record.
'R' = Return work days
'T' = Terminate cache
'D' = Debug Mode
EV01 Error Code ON '0' = Success Process
'1' = Failed to Return Work
Days(mode
'R' only)
'2' = Fetch Failed(mode 'G'
only)
'3' = Failed to Create Cache
'4' = Calendar Not Setup
INT01 Number of Keys I Number of Keys to be used in
the
cache process for action code
'G'
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
^
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
szJobNumber | JOB | char | NONE | NONE |
Job Number | ||||
szBranch | 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
| ||||
nType | INT01 | integer | NONE | NONE |
Number of Days in Future to Query for Responses Due. | ||||
jdDate | DRQJ | JDEDATE | NONE | NONE |
The date that an item is scheduled to arrive or that an action is scheduled for completion. | ||||
jdStartDate | DATE01 | JDEDATE | NONE | NONE |
Event point for JDE Date. | ||||
nWorkDays | INT02 | integer | NONE | NONE |
Number of Days in the Past to Query for Quote Requests Received. | ||||
cActionCode | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. | ||||
cErrorCode | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. | ||||
nNumberOfKeys | INT03 | integer | NONE | NONE |
Event point for Integer. | ||||
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
|
None |
F0007 Workday Calendar |