17.00 - Rate Code Example - Parallel Transporter

Teradata® Parallel Transporter Application Programming Interface Programmer Guide

prodname
Parallel Transporter
vrm_release
17.00
created_date
June 2020
category
Programming Reference
featnum
B035-2516-220K

Add the following code to your application anytime after the Stream driver has initiated and before it has terminated.

             char *dataptr1;
             TD_Length datalen1;
             int queryStatus1 = 0;
             TD_Index index = 0;
             char rate[10];
             int pdcty;
             cout << "Enter RATE : " << endl;
             cin >> rate;
             cout << "Enter PERIODICITY : " << endl;
             cin >> pdcty;
             dataptr1 = (char*)malloc(96);
             memset(dataptr1, 0, sizeof(dataptr1));
             sprintf(dataptr1, "RATE = %s,PERIODICITY = %d", rate,pdcty);
             datalen1=9*sizeof(dataptr1);

             queryStatus1 = conn -> PutEvent(TD_Evt_UserCommand, 
             dataptr1, datalen1, index);

             cout << "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
             cout << "             RATE INFO                   " << endl;
             cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;

             if ( queryStatus1 < TD_Error && queryStatus1 !=              TD_Unavailable )
             {
             cout << "New Values: " << dataptr1 << endl;
             cout << "New Length: " << datalen1 << endl;
             }
             else
             {
             printf("TD_Evt_UserCommand event failed with status = %d",              queryStatus1);
}