T_PRSBDR - Parse Batch Detail Report


// Example Program: T_PRSBDR // Description: // This is a test program to demonstrate parsing a batch detail report // file using the CTI_ParseBatchDetailReport() API. // // This batch detail report file must have been previously downloaded // with the CTI_DownloadReport() API - see the T_DWNLRPT example // program for a demonstration of this API. // // To parse the batch detail data, generate a new unique ID with the // CTI_NextUniqueID() API. Then, call the API, passing in your unique // ID, the fully-qualified filepath for the report file, and the error // data structure parameters as shown. // // CTI_ParseBatchDetailReport() will return *On if no error was // encountered, or *Off if an error occurred. If an error occurred, // you should look at the fields in ErrorDS to retrieve information // about the error. Additional error information may be found in the // CTIERR file, or in the record for this query in the CTIBDR file. // // Otherwise, you can perform a CHAIN against the CTIBDR physical // file, and the other CTIBDR* files, and retrieve the parsed fields. Ctl-Opt ActGrp(*Caller) BndDir('CTIBND') Option(*NoDebugIO); /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; Dcl-S Filepath Like(CTI_FilePath_t) Inz; // This holds any error information returned by the API call Dcl-Ds ErrorDS LikeDS(CTI_ErrorDS_t) Inz(*LikeDS); // Modify this field to use your merchant ID Dcl-S MerchantId Like(CTI_MerchantId_t) Inz('ikrengel'); reset ErrorDS; UniqueId = CTI_NextUniqueId(); // This API will only parse a report in XML format Filepath = '/ktprod/cti/downloads/batchdetail_51.xml'; if not CTI_ParseBatchDetailReport( UniqueId : Filepath : ErrorDS ); WriteToJobLog( 'Failure' + NewLine ); WriteToJobLog( 'Source: ' + ErrorDS.Source + NewLine ); WriteToJobLog( %Trim(ErrorDS.MessageId) + ': ' + ErrorDS.Message + NewLine ); else; WriteToJobLog( 'Success' + NewLine ); endif; *INLR = *On; return;