×
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.
I have used this API quite a bit in the past and there is an example of using it in my book APIs at Work, Second Edition in Chapter 10 - Message APIs.
I don't have the time (well actually more the desire) to go through all of your attached code in any detail, but a few things do jump out at me:
1. Where do you initialize your message watch and LICLog watch structures? There are reserved fields in the message watch structure, so I would have expected to see a One_Watch = *loval somewhere. As the number of LICLog watches is 0 you don't need to bother initializing those associated structs.
2. Offsets should be 0 as you are not providing any comparision data.
3. Terminology wise, offsets are based from the beginning of the parameter. Displacements are based from the beginning of the current structure instance.
4. There is no need to set BytesAvailable of the Error code structure. If BytesProvided is 8 or greater, the API will set BytesAvailable to 0, upon return, if no error is found.
Hope this helps some,
Bruce Vining
Bruce Vining Services
Alan Campin <Alan.Campin@xxxxxxxxxxxxxxxx> wrote:
Has anyone done any work with the new STRWCH API QSCSWCH?
I have written code to load a list of message id's to monitor QSYSOPR
but every time I call the API, I get back the famous CPF24B4 (Severe
Parameter Error) and nothing to explain what the error is.
I have reported the problem to IBM but wondering if anyone has written
code to this API.
I have declared the following data structure for each message.
d TD_One_Watch...
d ds Qualified
d Based(StdNulPtr)
d LengthOfMessageData...
d Like(StdInt)
d Message_Id...
d Like(StdMsgId)
d Reserved1...
d Like(StdChr)
d WatchedMessageQueueName...
d Like(StdNam)
d WatchedMessageQueueLibrary...
d Like(StdNam)
d WatchedJobName...
d Like(StdNam)
d WatchedJobUser...
d Like(StdNam)
d WatchedJobNumber...
d Like(StdJobNum)
d Reserved2...
d 6a
d OffsetToComparisonData...
d Like(StdInt)
d LengthOfComparisonData...
d Like(StdInt)
d CompareAgainst...
d Like(StdNam)
The following data structure for a dummy Lic Log.
d TD_One_Lic...
d ds Qualified
d Based(StdNulPtr)
d LengthOfLicLogData...
d Like(StdInt)
d LicLogMajorCode...
d 4a
d LicLogMinorCode...
d 4a
d OffsetToLicLogComparison...
d Like(StdInt)
d LengthOfLicLogComparisonData...
d Like(StdInt)
I have then declared another data structure with count and array of
watches.
d WatchedMessagesDs...
d ds Qualified
d Based(ptrWatchedMessages)
d Count...
d Like(StdInt)
d WatchList...
d LikeDs(TD_One_Watch)
d Dim(100)
Another for dummy lic log.
d WatchedLicDs...
d ds Qualified
d Count...
d Like(StdInt)
d WatchList...
d LikeDs(TD_One_Lic)
I load the array using the new Eval-Corr. Really makes life easy.
// Allocate enough storage to hold the entire list.
ptrWatchedMessages = %Alloc(%Size(MessageIdCount) +
(MessageIdCount * %Size(TD_One_Watch)));
For x = 1 to MessageIdCount;
One_Watch.Message_Id = MessageIdList(x).MessageId;
Eval-Corr WatchedMessagesDs.WatchList(x) = One_Watch;
EndFor;
My call is declared as:
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 LikeDs(WatchedMessagesDs)
d PR_WatchLic...
d LikeDs(WatchedLicDs)
d PR_ApiError...
d LikeDs(TD_StdErrorModel)
Constants defined as.
d cExitProgramName...
d c 'XV0040 '
d cExitProgramLib...
d c '*LIBL '
And every time I get a CPF24B4 back. I don't get it. I can't find any
error. I look at the data structures when it comes back and nothing has
been corrupted.
I walk through it in debug and every record is loaded correctly and
unless the documentation is incorrect, my call looks fine.
Also, does anyone understand what IBM is asking for in the Offset to
Comparison Data. I have tried 0, 82 and now 1. Is it the offset of the
beginning of the data structure or the offset from within the message
data to start looking for a comparison like you can do in system reply
list? I am hoping it is the latter.
Anyway thanks for any help.
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.