T_PRSEDR - Parse an Exception Detail Report

**FREE
// Example Program: T_PRSEDR
// Description:
//  This is a test program to demonstrate parsing an exception detail
//  report file using the CTI_ParseExceptionDetailReport() API.
//
//  This exception 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 exception 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_ParseExceptionDetailReport() 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 CTIEDR file.
//
//  Otherwise, you can perform a CHAIN against the CTIEDR physical
//  file, and the other CTIEDR* 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/exceptiondetail_1099.xml';

if not CTI_ParseExceptionDetailReport( UniqueId : Filepath : ErrorDS );
  WriteToJobLog( 'Failure' + NewLine );
  WriteToJobLog( 'Source: ' + ErrorDS.Source + NewLine );
  WriteToJobLog( %Trim(ErrorDS.MessageId) + ': '
               + ErrorDS.Message + NewLine );
else;
  WriteToJobLog( 'Success' + NewLine );
endif;

// Write unique ID to job log for easy reference
WriteToJobLog( 'T_PRSEDR Unique ID: ' + %Char(UniqueId) + NewLine );

*INLR = *On;
return;