When a .NET assembly generates an event, it makes information about the event available through event parameters. These parameters are stored in the assembly and can be retrieved by calling C$GETNETEVENTDATA from the assembly's event procedure.
CALL "C$GETNETEVENTDATA" USING EVENT-CONTROL-HANDLE, DEST-ITEM-1, [DEST-ITEM-2, ...] GIVING RESULT-CODE
EVENT-CONTROL-HANDLE USAGE HANDLE | Handle to the .NET assembly that generated the event. |
DEST-ITEM-1 Any COBOL data type | The first destination data item. |
DEST-ITEM-2, ... Any COBOL data type (optional) | Any number of destination items. |
RESULT-CODE Signed numeric value | Receives the result-code for the operation. This will be 0 to indicate success or a negative value to indicate failure. (Microsoft defines many standard "result codes" in their documentation. Note that these are usually in hexadecimal notation.) |
C$GETNETEVENTDATA converts the event parameters to COBOL-type data in the destination items.
You are responsible for specifying compatible types. For instance, if the event parameter is a character string and you specify a numeric item to receive its value, C$GETNETEVENTDATA will try to read a number from the string and move it to your numeric item. This is not a programming error and neither the compiler nor runtime will warn you about it.
Suppose you have displayed a .NET assembly that triggers an event called NetEventOne that has three parameters. You would use the following COBOL syntax to get the event parameters into data items PARAM-1, PARAM-2 and PARAM-3:
WHEN NetEventOne CALL "C$GETNETEVENTDATA" USING EVENT-CONTROL-HANDLE, PARAM-1, PARAM-2, PARAM-3