// Example Program: T_TRNEXRPT
// Description:
// This program demonstrates the CTI_RunTransExpDetailReport()
// subprocedure. This subprocedure retrieves CyberSource's on-demand
// transaction exception detail report.
//
// This example demonstrates processing a report which was downloaded
// and saved to the IFS, and which has an associated record in CTIRPT.
// It will parse the contents of the report file into the CTIRPT*
// output tables.
//
// This program assumes that you have correctly configured your
// merchant and environment tables (CTICFGMCH and CTICFGENV) and that
// you have at least one valid batch transaction on the given date.
Ctl-Opt ActGrp(*Caller) BndDir('CTIBND');
/COPY QRPGLECPY,CTICB
// This is included for demo output purposes.
Dcl-Pr WriteToJobLog Int(10) Extproc('Qp0zLprintf');
pString Pointer Value Options(*String);
End-Pr;
Dcl-C NewLine x'15';
// This stores the unique ID for this API call
Dcl-S UniqueId Like(CTI_UniqueId_t) Inz;
// This holds any error information returned by the API call
Dcl-Ds ErrorDS LikeDS(CTI_ErrorDS_t) Inz(*LikeDS);
// This holds configuration values for the report request API call
Dcl-Ds ReportDS LikeDS(CTI_ReportAPIConfigDS_t) Inz(*LikeDS);
// To retrieve the information for the report, we need to provide a
// unique ID that corresponds to a record in CTIRPT.
UniqueId = 00000;
ReportDS.MerchantId = 'YOUR_MERCHANT_ID';
ReportDS.Operation = CTI_PROCESS_REPORT;
// We do not need to specify a report filepath because the program will
// retrieve that information from the CTIRPT record.
if not CTI_RunTransExpDetailReport( UniqueId : ReportDS : ErrorDS );
WriteToJobLog( 'Error Message Id: ' + ErrorDS.MessageId + NewLine );
WriteToJobLog( 'Error Message: ' + ErrorDS.Message + NewLine );
WriteToJobLog( 'Error Source: ' + ErrorDS.Source + NewLine );
endif;
*INLR = *ON;
return;