You can write a program that invokes a flow from a remote platform. See the iWay API Reference manual for details on your platform and desired calling language.
In this example, the error logic performed after EDAACCEPT will depend on values returned by CMASAP to your program. There are two scb values that need to be reviewed:
Error |
Description |
---|---|
18764 |
Flow has failed. |
18528 |
Flow name was blank. |
18529 |
Flow not found. |
18561 |
Flow was not submitted. |
The following is a sample C program for starting flows remotely.
Note: You must enhance this code as necessary to reflect production requirements.
// Run specified request
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h>
#define EDA_TYPES #define EDA_VARIABLES #define LINT_ARGS #include "eda.h"
// chk_status - check status code in scb. if non-zero // print out last command and status code static long chk_status(EDA_SCB *scb_p,long status) { char command[12]; status = scb_p->status; // add processing to decode status codes here if (status != 0) {strncpy(command, scb_p->command,12); command[12]='\0'; printf("\n%s (%5ld) %s",command,status); } return(status); }
void main() { EDA_ID *eid_p, eid; // Pointer and EDA ID for this application. EDA_SCB *scb_p, scb; // Pointer and Session Control Block. long status; // Status return codes from API char msg[3]; // EDA message origin
char server[] = "SERVER"; // Replace with your server char userid[] = "USERID"; // userid char password[] = "PASSWORD"; // password char rpcname[] = "CMASAP"; // Leave as CMASAP char request[] = "REQ_NAME=TESTING"; // Replace with request name
long s_len, p_len, u_len, c_len, r_len; // length of strings long id, wait, zero = 0L; // EDAWAIT, TEST parms
eid_p = &eid; scb_p = &scb; // point to EDA structures
// Get lengths of all the parms s_len = strlen(server); u_len = strlen(userid); p_len = strlen(password); c_len = strlen(rpcname); r_len = strlen(request);
// Initialize EDA EDAINIT(eid_p, &status); if (status != 0) {printf("EDAINIT (%5ld)",status); return;}
// Connect to Server EDACONNECT(eid_p, scb_p, userid,&u_len, password,&p_len, server,&s_len); if (chk_status(scb_p,status) != 0) {EDATERM(eid_p, &status); return;}
// Invoke RPC EDARPC(scb_p, rpcname, &c_len, request, &r_len); if (chk_status(scb_p,status) != 0) {EDATERM(eid_p, &status); return;}
EDATEST(scb_p,&wait); // Eject Messages if (chk_status(scb_p,status) != 0) {EDATERM(eid_p, &status); return;}
// Check for messages if (scb_p->msg_type) // Are there any messages? {if (scb_p->msg_code) // Is it really a message {strncpy(msg,scb_p->msg_org,3); // First 3 chars (ie: EDA) are clean msg[3]='\0'; // Null terminate printf("\n%s (%4ld) ",msg, scb_p->msg_code); printf("%s", scb_p->msg_text); } while (scb_p->msg_pending) // Any more messages? {EDAACCEPT (scb_p); // Pull them out if (scb_p->msg_code) // Are they really messages? {strncpy(msg,scb_p->msg_org,3); msg[3]='\0'; printf("\n%s (%4ld) ",msg, scb_p->msg_code); printf("%s", scb_p->msg_text); if (scb_p->msg_code == 18762) // See if we're done printf("Job submitted.\n"); } } }
// Terminate connection EDATERM(eid_p, &status); return; }
iWay Software |