Using Preprocessing with the XcomQAPI With CA XCOM Data Transport

Document ID : KB000028014
Last Modified Date : 11/01/2019
Show Technical Document Details

The Application Programming Interface (API) is intended to give programmers the capability of developing their own CA XCOM Data Transport applications. There are two CA XCOM Data Transport APIs. They are:

The XcomAPI provides the ability to submit transfers to CA XCOM Data Transport.

The XcomQAPI provides the same functionality to manage the queue as the XCOMQM command line function, but through an API.

This knowledge article discusses how to use preprocessing with the XcomQAPI.


Look at the end of the qapitest.c sample file to find a section that looks like this:

                       note: This option only allow to call when xcbp->state is in PREALLOCATION_STATE */
                    xcomqparm->funccode[0] = 'p';
                    strcpy(xcomqparm->tid, "000001");
                    strcpy(xcomqparm->file_option, "CREATE");
                    strcpy(xcomqparm->lfile, "/home/userid/test.txt");
                    strcpy(xcomqparm->rfile, "/home/userid/test.del");
                    /* check for error message */ 
                    if (strlen((*xcomqparm->pQueue)[0].array_err_message))
                       printf("%s", (*xcomqparm->pQueue)[0].array_err_message);
                    /* print out queue entry information */
                    if (strlen((*xcomqparm->pQueue)[0].array_message))
                       printf("%s", (*xcomqparm->pQueue)[0].array_message);
                    printf("====  QAPI ended  ===\n");

To call the XCOMPRE script from the XcomQAPI

1. You should have a customized XCOMPRE script.
2. You must point to that script in the xcom.glb file with the XPRECMD parameter.
3. Recycle the XCOM daemon so your changes made to the xcom.glb file to be effective.

After a file transfer request is submitted, but before any data transmission begins, XCOM adds the transfer to the queue. It is during this same pre-data-transmission phase of the transfer that XCOM runs the XCOMPRE scrip. If you want your program to be able to check for specific conditions or parameter values and conditionally change those values, you could do so with the XCOMPRE script.

For example, suppose it was against policy to write a file to a particular directory, but rather than have a transfer fail with a security error, you will just re-route that transfer to a different directory. As you can see from the above excerpt from the sample qapitest.c file, you have access to the "lfile" parameter, allowing your application the ability to make the directory name change in the transfer request before the transfer is started from the queue.