Sending a Command to IBM Connect:Direct Using ndmapi_sendcmd() or ndmapi_sendcmd_c()
Use ndmapi_sendcmd() or ndmapi_sendcmd_c() to allow a command to be sent to a IBM® Connect:Direct® application. Following is the format of ndmapi_sendcmd() or ndmapi_sendcmd_c():
int32 rc, resp_moreflag;
struct sendcmd_data ret_data;
rc=ndmapi_sendcmd (error,
"select process pnumber=2,",
&resp_moreflag,
&ret_data
);
Following are the parameters for ndmapi_sendcmd() or ndmapi_sendcmd_c():
Parameter | Description | Value |
---|---|---|
error | A pointer to a IBM Connect:Direct-defined structure that contains error information or status information. | Pointer |
cmd_text | A pointer to the null-terminated text string that specifies the command to send to IBM Connect:Direct. The command text must be followed by a semicolon and terminated with a null. When you use the submit=filename command from the API, ensure that you allocate enough storage for the Process text. The text of the Process submitted is returned in the text string associated with this parameter when the function completes. If you do not allocate enough storage for the Process text, a core dump can result. |
Pointer to a text string |
resp_moreflag | A pointer to the flag that indicates that more responses are pending for the command just executed. Invoke ndmapi_recvresp() or ndmapi_recvresp_c() to retrieve the extra responses. | Pointer to a flag |
ret_data | A pointer to a structure containing internal response information for a command. The structure is:
|
Pointer to a structure |
sendcmd_data | Provides the caller with some information about the user request. Because parsing of command text occurs at the CMGR, the End User Application (EUA) has no way to identify the command that was submitted, unless it generated the text. | Information about the user request |
cmd_name | A pointer to a string with the name of the command submitted. The CLI uses this pointer to display completion messages. This field enables you to display unique completion messages without any knowledge of a specific command in the EUA. | Pointer to name of command |
cmd_id | A four-byte identifier of the command that was found in the command text. Following are the four-byte identifiers:
The CLI uses these identifiers to ensure that rules are being followed. For instance, if an ndmapi_sendcmd returns with the resp_moreflag set and the cmd_id is not SELECT_STATISTICS or SELECT_PROCESS, the CLI generates an error. |
Four-byte identifier |
data1, data2, and data3 | For future expansion. data1 is used with the submit command to return the Process number. data2 is used with the submit command to return the result of the Process (0, 4, 8, or 16) |
The ndmapi_sendcmd_c() function call has the following return codes:
Return Code | Description |
---|---|
NDM_NO_ERROR or Process Number | The function completed successfully. |
NDM_ERROR | An error occurred. Consult the error structure for detailed error status. |
Following is a sample ndmapi_sendcmd() function:
int32 rc, resp_moreflag;
struct sendcmd_data ret_data;
rc=ndmapi_sendcmd (error,
"select process pnumber=2 ;",
&resp_moreflag,
&ret_data
);