×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Passing a based structure to the API should work without a problem. If you would like, feel free to email me directly a compilable source member which demonstrates the failure and I will take a look at it.
To answer your questions:
1. The API is not aware of how the storage was originally allocated. The API will verify that the storage was allocated from user domain storage, but not how/when it was allocated. The storage could be static, dynamically allocated (from SLS or teraspace for that matter), a user space, a user allocated heap, etc.
2. The API would not be addressing storage beyond the defined size you passed in. Some APIs (and the number should be dwindling as this can have unintended side effects) will address the last byte of an output variable to avoid addressing exceptions later in the code, but that would still be constrained by the size information passed in to the API.
My first thought is that the value for ptrWatchedMessages is not addressing the start of the data structure when the API is called. But I'm sure you have probably verified that piece a few dozen times :-)
Bruce
Bruce Vining Services
Alan Campin <Alan.Campin@xxxxxxxxxxxxxxxx> wrote:
Well tracked it down to the fact that the data structure for the fourth
parameter was defined to be based on a pointer. If I take out the
dynamic allocation of storage and just have it allocate space for 100
messages, it works! Now the question is why doesn't it work? I have
dynamically allocated storage for parameters for years. How would the
API even know that the storage was dynamically allocated?
I dynamically allocated storage because I have a variable number of
messages coming in.
I wonder if the programmer who wrote the API is trying to reference to
the something beyond the count of 2 that I sent him. Very puzzling.
As you can see, I have changed the prototype declarations to match what
Bruce has in his book but still not work until I took out the pointer
declaration.
Where this gets to be a problem is if in the future I want to add
comparison data. Since that is variable in length, I cannot just
allocate the storage with a fixed 100. Each message is going to be
variable in length. If I can't allocate storage dynamically, I have a
problem.
Anybody have an idea how you would declare the API so that the data
structure can be based on a pointer?
d WatchedMessagesDs...
d ds Qualified
d Based(ptrWatchedMessages)
d Count...
d Like(StdInt)
d WatchList...
d LikeDs(TD_One_Watch)
d Dim(100)
// Allocate enough storage to hold the entire list.
ptrWatchedMessages = %Alloc(%Size(MessageIdCount) +
(MessageIdCount * %Size(TD_One_Watch)));
d StartWatchAPI...
d pr ExtPgm('QSCSWCH')
d PR_SessionId...
d Like(StdNam)
d Const
d PR_UsedSessionId...
d Like(StdNam)
d PR_WatchProgram...
d Like(StdQNam)
d Const
d PR_WatchedMessages...
d 65535 Const
d Options(*Varsize)
d PR_WatchLic...
d 65535 Const
d Options(*Varsize)
d PR_ApiError...
d LikeDs(TD_StdErrorModel)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.