× 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.



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 thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.