In the pseudocode example, the caller issues a call to register
to be notified when the command response events and status change
events occur.
Declare (ReturnCode, EventAction, EventExitMode) Fixed(31);
Declare ConnectToken Isa(HWI_CONNTOKEN_TYPE):
Declare EventIDs Isa(HWI_EVENTIDS_TYPE):
Declare (EventExitAddr, EventExitParm) Ptr(31);
Declare DiagArea Isa(HWI_DIAGAREA_TYPE);
Declare EventExit Entry External;
EventAction = HWI_EVENT_ADD;
Hwi_EventID_EyeCatcher = HWI_EVENTID_TEXT;
Hwi_Event_CmdResp = on;
Hwi_Event_StatusChg = on;
Hwi_Event_Reserved = 0;
EventExitMode = HWI_EVENT_TASK;
EventExitAddr = ADDR(EventExit);
EventExitParm = 0;
CALL HWIEVENT (ReturnCode, ConnectToken, EventAction, EventIDs,
EventExitMode, EventExitAddr, EventExitParm, DiagArea);
A REXX programming example for the HWIEVENT service:
myAction = HWI_EVENT_ADD
myEventIDs. = 0 /*Initialize all EventIds to 0 */
myEventIDs.Hwi_Event_CmdResp = 1
myEventIDs.Hwi_Event_StatusChg = 1
myEventIDs.Hwi_Event_ActProfChg = 1
myMode = HWI_EVENT_TASK
myEventExitAddr = 0F123456 /* char rep of 4 byte hex address */
myEventExitParm = 0
address bcpii
"hwievent RetCode myConnectToken myEventAction myEventIDs. myEventExitMode
myEventExitAddr myEventExitParm myDiag."
If (RC <> 0) | (Retcode <> 0) Then
Do
Say 'Service failed with REXX RC = 'RC' and API Retcode = 'Retcode'.'
If (RC=Hwi_REXXParmSyntaxError | Retcode<>0) Then
Do
Say ’ Diag_index=’ myDiag.DIAG_INDEX
Say ’ Diag_key=’ myDiag.DIAG_KEY
Say ’ Diag_actual=’ myDiag.DIAG_ACTUAL
Say ’ Diag_expected=’ myDiag.DIAG_EXPECTED
Say ’ Diag_commerr=’ myDiag.DIAG_COMMERR
Say ’ Diag_text=’ myDiag.DIAG_TEXT
End
End