Previous Topic: About the XcomAPI Example

Next Topic: XcomQAPI Example


API Return Codes

The CA XCOM Data Transport for Windows API has the following return codes:

603

The TP state is invalid.

602

There was a general error in queue function.

601

Permission denied.

600

Transfer is not active.

469

XCOMD CA XCOM Scheduler service is not running or is not compatible

0

The transfer was successful.

-1

The named file does not exist or is not accessible in the given mode.

-9

XCOMQM detected an unknown error.

-1100

XCOMQM is unable to find the entry in the queue.

-1801

XCOMQM is unable to open the index file.

-1802

XCOMQM is unable to close the index file.

-1803

XCOMQM detected invalid command line options

Example:

The following is a C language example of a program using the API that receives a remote file named /u/user/test.txt and replaces the local file named d:\temp\test.txt2 using the TCP/IP protocol.

/* apitest.c - This is a sample program for calling the XcomAPI.  */
/*             Modify this according to your needs and make it    */
/*             with the sample 'apitcp.mak' / 'apisna.mak'        */
/*             in this directory.                                 */
/*             Please note that XcomAPI is not thread safe.       */
#include <stdio.h>
#include "xcomapi.h"
main(int argc,char **argv)
{
    int rc;
    XCOM_PARM xcomparm;
    int starting_state;
     memset(&xcomparm,0,sizeof(xcomparm));
/*  xcomparm.file_type = SEND_FILE;      "1" */
    xcomparm.file_type = RECEIVE_FILE; /* "4" */
    /* remember to link with the appropriate xcom libraries for
       each protocol */
    xcomparm.protocol = "TCPIP";     /* "SNA" or "TCPIP" */
    xcomparm.remote_system = "0.0.0.0";
    xcomparm.port = "8044";
    xcomparm.xluname = "";    
    xcomparm.xmode = "";
    xcomparm.local_file = "d:\\temp\\test.txt2";
    xcomparm.remote_file = "/u/user/test.txt";
    xcomparm.local_file_rf = "d:\\temp\\test.txt2";
    xcomparm.remote_file_rf = "/u/user/test.txt";
    xcomparm.file_option = "REPLACE";
    xcomparm.userid = "";
    xcomparm.password = "";
    /* if queue = NO, must link with right xcom lib */
    xcomparm.queue = "NO";
    xcomparm.code_flag = "ASCII";
    xcomparm.truncation = "YES";
    xcomparm.xtrace = "10";
    xcomparm.stat_frequency = "1";
    xcomparm.trusted   = NULL;
    xcomparm.domain    = NULL;
    xcomparm.den       = NULL;
    xcomparm.expdt     = NULL;
    xcomparm.retpd     = NULL;
    xcomparm.label     = NULL;
    xcomparm.tape      = NULL;
    xcomparm.unitct    = NULL;
    xcomparm.volct     = NULL;
    xcomparm.volsq     = NULL;
   /* These parms are new for r11 XCOM */
    xcomparm.xcomfullssl = NULL;
    xcomparm.configssl   = NULL;
    xcomparm.codetabl    = NULL;
    xcomparm.rmtntfyl    = NULL;
    xcomparm.lclntfyl    = NULL;
    xcomparm.storcls     = NULL;
    xcomparm.datacls     = NULL;
    xcomparm.mgtclas     = NULL;
    xcomparm.dsntype     = NULL;
    xcomparm.createdelete=NULL;
    xcomparm.compress_pds=NULL;
    xcomparm.local_charset=NULL;
    xcomparm.remote_charset=NULL;
    xcomparm.mbcs_inputerror=NULL;
    xcomparm.mbcs_converror=NULL;
    xcomparm.local_delim=NULL;
    xcomparm.remote_delim=NULL;
    xcomparm.eattr=NULL;
    xcomparm.avgrec=NULL;

    starting_state=LOCAL_RECEIVE;
    printf("==== API Started ====\n");
    rc=XcomAPI(starting_state, xcomparm);
    if (rc)
       printf("==== %s\n", msgstring(rc,0));
    printf("==== API Ended ====\n");
  return rc;
}