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



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)));

// Load defaults for one watch.
One_Watch.LengthOfMessageData = %Size(One_Watch);
One_Watch.WatchedMessageQueueName = '*SYSOPR';
One_Watch.WatchedMessageQueueLibrary = *Blanks;
One_Watch.WatchedJobName = *Blanks;
One_Watch.WatchedJobUser = *Blanks;
One_Watch.WatchedJobNumber = *Blanks;
One_Watch.OffsetToComparisonData = 1;
One_Watch.LengthOfComparisonData = 0;
One_Watch.CompareAgainst = *Blanks;

// Load values for dummy lic log. Not used.
One_Lic.LengthOfLicLogData = %Size(WatchedLicDs);
One_Lic.LicLogMajorcode = *Blanks;
One_Lic.LicLogMinorCode = *Blanks;
One_Lic.OffsetToLicLogComparison = 1;
One_Lic.LengthOfLicLogComparisonData = 0;
WatchedLicDs.Count = 0;
Eval-Corr WatchedLicDs.WatchList = One_Lic;

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 '

Ok, only need to make the call.

// Set the watch.
WatchedMessagesDs.Count = MessageIdCount;
Api_Error.Size = %Size(Api_Error);
Api_Error.BytesAvailable = 0;
StartWatchApi(InSessionId :
OutSessionId :
cExitProgramName + cExitProgramLib:
WatchedMessagesDs :
WatchedLicDs :
Api_Error );


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