Tupelo Wilco Son Volt
Functional Description
Purpose
The purpose of this function is to store header data relevant to table (F08330) in JDECache Memory.
The header data is data common to all functions within N0800044. This data can then be accessed for
retrieval and manipulation prior to updating the table.
Setup Notes and Prerequisites
Records can be Read, Added, Deleted, or Updated to the cache, depending on Cache Action Code, CACTN,
passed in. The following is a list of the modes used to select cache processing options:
Input
Processing TypeType
============
Cache Get 1
Cache Add 2
Cache Update 3
Cache Delete 4
Cache Delete All 5
Cache Get Next 6
Cache Add/Update 7 (Do Not Use)
Cache End 8
Cache Close Cursor 9
Return errors through Error Message ID, DTAI.
The cache Key is as follows:
JobNumberA (from next number server X0010)
between a full or a partial fetch. JobNumberA must always be part of the key.
The Cache Cursor, GENLNG must be past to and from the BSFN.
When adding a record always attempt to Get the record first. If no error is returned then the record
already exists and it cannot be added.
Special Logic
Technical Specifications
include the header file b0800030.h
Declare Variable
IDnJDBReturn;
ID idReturnValue= ER_SUCCESS;
char szErrorID[11];
int iCacheActionCode;
Declare Data Structures
DSD0800030B dsCacheKey;
DSD0800030B dsSaveData;
Declare pointers
HUSER hUser = (HUSER) NULL;
HCACHE hCacheHandle = (HCACHE) NULL;
Check for NULL pointers, if there are null pointers set error '4363'
Begin Main Processing
Initialization Of DS Structure and Save of Workfields
Initialize the Behavior
If an error occurs initializing the behavior and if cSuppressErrorMessage does not = '1' then
set error.
iCacheActionCode=atoi(lpDS->szCacheActionCode);
Initialize the Cache
Call internal function I0800030B_InitCache
If no error initializing cache then Process Action code
If iCacheActionCode past in = 1 (Get) then call internal function
I0800030B_CacheAdd.
If iCacheActionCode past in = 3 (Update) then call internal function
I0800030B_CacheDeleteAll.
If iCacheActionCode past in = 6 (Get Next) then call internal functionI0800030B_CacheGetNext.
If iCacheActionCode past in = 7 (Add Update) then call internal function
I0800030B_CacheAddUpdate.
If iCacheActionCode past in = 8 (End) then call JDE function
JdeCacheTerminateAll.
If iCacheActionCode past in = 9 (Close Cursor) then call internal
Return value of saved fields after cache processing is completed
szErrorMessageID = szErrorID
mnNumberKeys = mnNumberKeys);
Function Clean Up
Free the Behavior
If the pointer szErrorMessageID is not blank and cSuppressErrorMessage does not = '1' then set error.
Internal functions
Function: I0800030B_InitCache
Initialize cache for Plan Amounts
Declare Variables
DSD0800030BdsCacheKey;
JDECMINDEXSTRUCTIndex[1];
Main Processing
Initialize output
SzErrorID = ""
Initialize the cache
Setup And Initialize Cache-Keys to Create Cache once
Set Memory, memset(Index, 0x00, sizeof(JDECMINDEXSTRUCT));
Set the number of segments of the key to = '1'
The first segment of the key is mnJobNumberA
Index->CacheKey[0].nOffset = offsetof(DSD0800030B, mnJobnumberA);
Index->CacheKey[0].nSize = sizeof(dsCacheKey.mnJobnumberA);
Index->CacheKey[0].idDataType = EVDT_MATH_NUMERIC;
Set lphCacheHandle = "B0800030B",
If there is an error szErrorID = ERR_INIT_CACHE
Function: I0800030B_CacheGet
Declare Variables
JDECM_RESULT jdeCacheCode = JDECM_PASSED;
int iNumberOfKeys;
HJDECURSOR hCursor = (HJDECURSOR) NULL;
DSD0800030BdsCacheData;
BOOLbChangedKey;
Main Processing
Initialize output
Set Memory
szErrorID = ""
Initialize Variables
Open the Cursor if error then szErrorID = "ERR_OPEN_CURSOR"
If no error Reset Cursor
If iNumberOfKeys = '0' then Fetch the first record
Else fetch the record matching the keys
If there is an error with the fetch then szErrorID = ERR_FETCH_RECORD
if the Cursor does not = NULL then close the cursor
Function: I0800030B_CacheAdd
Declare Variables
ID idCacheCursor;
Initialize output
SzErrorID = ""
Set the cache with the number or keys = mnNumberKeys
Set the cursor = idCacheCursor
Copy the memory needed the size of DSD0800030B
Add the record the size of DSD0800030B
If Add fails then szErrorID = ERR_ADD_RECORD
Function: I0800030B_CacheUpdate
Declare Variables
HJDECURSOR hCursor = (HJDECURSOR) NULL;
DSD0800030BdsCacheData;
Initialize output
SzErrorID = ""
Set the cache with the number or keys = mnNumberKeys
Set the cursor = idCacheCursor
Set the memory needed the size of DSD0800030B
Fetch the record, if record is found Update the record
If there is an error then szErrorID = ERR_UPDATE_RECORD
Close the Cursor
Function: I0800030B_CacheDelete
Declare Variables
JDECM_RESULT jdeCacheCode = JDECM_PASSED;
int iNumberOfKeys;
HJDECURSOR hCursor = (HJDECURSOR) NULL;
Main Processing
Initialize Variables
SzErrorID = ""
Set the cache with the number or keys = mnNumberKeys
If Number Of Keys = 0 Then call internal function I0800030B_CacheDeleteAll
else
Initialize the cursor
Set the memory the size of DSD0800030B
Fetch the record
If fetch is successful then delete the record
If there is an error deleting then szErrorID = ERR_DELETE_RECORD
If there is an error fetching then szErrorID = ERR_FETCH_RECORD
Close the cursor
Function: I0800030B_CacheDeleteAll
Declare Variables
JDECM_RESULT jdeCacheCode = JDECM_PASSED;
int iNumberOfKeys;
HJDECURSOR hCursor = (HJDECURSOR) NULL;
Main Processing
Initialize input and output
SzErrorID = ""
Copy the memory needed the size of DSD0800030B
Set the cache with the number or keys = mnNumberKeys
Open the Cursor
Delete all records
If there is an error on delete then szErrorID = ERR_DELETE_RECORD
Close Cursor
Function: I0800030B_CacheGetNext
Notes:Assumption is made this function will be performed until the
Cache Index is no longer equal to the input index. If this function is prematurely ended, the cursor
will have to be closed using function I0800030B_CloseCursor, or memory leaks will result from the
cursor being left open.
Declare Variables
JDECM_RESULTjdeCacheCode = JDECM_PASSED;
intiNumberOfKeys;
BOOLbMatchKey=FALSE;
BOOLbChangedKey;
HJDECURSOR hCursor = (HJDECURSOR) NULL;
DSD0800030BdsCacheData;
ID idCacheCursor;
Main Processing
Initialize output
SzErrorID = ""
Set the memory needed the size of DSD0800030B
Initialize Variables
Set the cache with the number or keys = mnNumberKeys
Set cursor for either initial fetch or subsequent fetches
If idCacheCursor = 0L then this is a subsequent search
Open Cursor
Fetch the Next record
If idCacheCursor <> 0L fetch the first record
If the fetch was successful
If the keys do not match then szErrorID = ERR_FETCH_RECORD
set idCacheCursor = 0L
Function: I0800030B_CacheAddUpdate
DO NOT USE THIS FUNCTION
Function: I0800030B_CloseCursor
Declare Variables
If idCacheCursor does not equal 0L then close cursor
Set idCacheCursor = 0L
Function: I0800030B_ChangedKey
Test to see if the key has changed
If it has changed then bChangedKey = True
Else
bChangedKey = FALSE;
End of Internal functions
D0800030B - F08330 Begin Doc TMBF Cache
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
mnJobnumberA | JOBS | MATH_NUMERIC | NONE | NONE |
Special Input Expected
| ||||
mnAddressNumber | AN8 | MATH_NUMERIC | NONE | NONE |
A number that identifies an entry in the Address Book system, such as employee, applicant, participant, customer, supplier, tenant, or
| ||||
szCacheActionCode | CACTN | char | NONE | NONE |
Special Input Expected
| ||||
mnNumberKeys | NKEYS | MATH_NUMERIC | NONE | NONE |
Special Input Expected
| ||||
cSuppressErrorMessage | SUPPS | char | NONE | NONE |
Special Input Expected
| ||||
idCacheCursor | GENLNG | ID | NONE | NONE |
Special Input Expected
| ||||
cWarningFlag | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. | ||||
cActionCode2 | ACTN | char | NONE | NONE |
A code that specifies the action that is performed. Valid values are: A Add C Change | ||||
cErrorConditions | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. | ||||
szVersion | VERS | char | NONE | NONE |
A user-defined set of specifications that control how applications and reports run. You use versions to group and save a set of user-defined
| ||||
szErrorMessageID | DTAI | char | NONE | NONE |
Special Output Returned
| ||||
szProgramId | PID | char | NONE | NONE |
The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry
| ||||
cUpdateEmpChangeFlag | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. | ||||
szCostCenterHome | HMCU | char | NONE | NONE |
The number of the business unit in which the employee generally resides. | ||||
cProcessEdits | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. |
None |
None |