Unable to fetch Cache record using jdeCacheFetchPosition API



I have created a cache business function. This will add, fetch and delete teh the records to Cache using switch program corresponding action will occur on cache.

This Cache was working fine while adding, and while fetching (jdeCacheFetch). But it is failing while calling jdeCacheFetchPosition. In this API we have key field values and it is not able to fetch values to the destination structure as shown in below attachment.

Any one could please help me on this. .c and .h files were attached for reference.


  • B59TEST8_C.txt
    15.4 KB · Views: 67
  • B59TEST8_H.txt
    5 KB · Views: 34
  • Error.jpg
    20.9 KB · Views: 30
Just quickly glancing at the code it's hard to see any immediate errors, I would probably have to debug it. You do seem to have a lot of extra code I don't think you need. For example, in the procedure in question you declare a variable dsCacheKey that you don't really every do anything meaningful with. Attached is a very simple cache "DAO" example to kind of give you some idea of a pattern. By no means the only way to do it but might give you some ideas. (Just ignore all the acmeSetErrorxxx and other acme "API" type calls and replace with standard JDE error APIs etc. - the acme calls are just macro wrappers for the JDE api calls so they are effectively the same thing.)


  • CacheDAOCodeSnippetExample.txt
    5.8 KB · Views: 43
Instead of using LPDSD59TEST8KEY as the key parameter, use the full cache LPDSD59TEST8CACHE. Because the key members or your index are not contiguous in the cache structure, just creating a key DS with only the members doesn't work. Basically, it doesn't work like JDB. I usually populate the key in the full cache DS and pass its pointer to both the key and cache return parameters.

I don't see any issue with the code.
Only possibility which i am sure is very remote i.e. if the data exists for your key?
Can you see that record in the cache?

Also, please send the sequence of your cache operations.
Last edited:
Hi Craig,

Thanks for your suggestion. I did replace LPDSTEST8KEY with LPDSTEST8CACHE full structure, but still not able to fetch the values. Shown in the attachment.

Hi Abhishek,
I am passing the data to key before doing fetch and there is data in the cache, as I am adding data to cache before fetching and also able to see the number of records using the jdeCacheGetNumRecords API.

Any suggestions???


  • Error1.jpg
    18.7 KB · Views: 25
Hi Craig,

Thanks a lot Craig, It's working!!!! The only thing I didnot change before this post is while defining index of the cache I kept LPDSD59TESTKEY as the offest of each parameter " dsCacheIndex->CacheKey[0].nOffset = offsetof(DSD59TEST8KEY, mnDocNo); ".

Now I changed it to DSD59TEST8CACHE and also Instead of using DSD59TESTKEY, I am using DSD59TEST8CACHE as you suggested. It's working now.

Thanks a lot Craig, I spent more time on this till now. You saved my time. Please find the updated code attached.

Sujit R


  • B59TEST8_C.txt
    15.5 KB · Views: 71
  • B59TEST8_H.txt
    5 KB · Views: 35
Yep, that would do it since the offset of the date member is different in the key structure. Glad it worked for you.