UPS_pkupCancel()
This subprocedure calls the UPS Pickup Cancel API. It reads in request data from UPSPXRQ and writes response data to UPSPXRS.
Subprocedure Prototype
|
Returns *OFF if an error occurs during processing, *ON otherwise. |
|
The ID of the record in UPSPXRQ that will be used to build the request, and under which the response data will be saved in UPSPXRS. |
|
The data structure in which error information will be returned. |
Example Code
*------------------------------------------------------------------------
* @Author: Kato Integrations
* @Description:
* This is a test program to illustrate how to call the UPS_pkupCancel()
* subprocedure to cancel a pickup request.
*
* To achieve this, generate a unique ID with UPS_getUID(), and
* then populate and write a record to UPSPXRQ. Then, call
* UPS_pkupCancel(), passing in your unique ID as well as
* the other parameters shown.
*
* UPS_pkupCancel() 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.
*
* Otherwise, you can perform a CHAIN against the UPSPXRS physical
* file, and retrieve the result fields.
*------------------------------------------------------------------------
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('UPSBND') OPTION(*NODEBUGIO)
FUPSPXRQ UF A E K DISK Qualified
FUPSPXRS IF A E K DISK Qualified
/COPY QRPGLECPY,UPS
// This is included for demo output purposes.
D WriteToJobLog PR 10I 0 Extproc('Qp0zLprintf')
D pString * Value Options(*String)
D NewLine C x'15'
D PXRQ DS Likerec(UPSPXRQ.RUPSPXRQ:*Output)
D PXRS DS Likerec(UPSPXRS.RUPSPXRS:*Input)
D ErrorDS DS LikeDS(UPS_ErrorDS_t) Inz(*LikeDS)
D UniqueID S Like(UPS_UniqueID_t)
/FREE
reset ErrorDS;
// Retrieve Unique ID used to identify this request
UniqueID = UPS_getUID();
clear PXRQ;
PXRQ.UID = UniqueID;
// Populate this field with application name set up using WRKUPSAUTH
PXRQ.UserID = 'KATO_TEST';
// Populate this field with a UPS account number configured in
// file UPSCFGACCT
PXRQ.AcctNbr = '523FE3';
// This specifies that we are cancelling by Pickup Request Number (PRN)
PXRQ.CnlBy = '02';
// This must be a valid Pickup Request Number
PXRQ.PRN = 'a1234567890';
write UPSPXRQ.RUPSPXRQ PXRQ;
// If UPS_pkupCancel() returns *Off, an error occurred and UPS_ErrorDS
// should be reviewed to determine the cause.
if not UPS_pkupCancel( UniqueID : ErrorDS );
WriteToJobLog( 'API Error: ' + NewLine );
WriteToJobLog( 'Error Code: ' + %Trim(ErrorDS.Code) + NewLine );
WriteToJobLog( 'Error Severity: ' +
%Char(ErrorDS.Severity) + NewLine );
WriteToJobLog( 'Error Source: ' + %Trim(ErrorDS.Pgm) + NewLine );
WriteToJobLog( 'Error Text: ' + %Trim(ErrorDS.Text) + NewLine );
exsr cleanup;
return;
else;
setll UniqueID UPSPXRS.RUPSPXRS;
if not %Found(UPSPXRS);
WriteToJobLog( 'ERROR: No results found in UPSPXRS' + NewLine );
exsr cleanup;
return;
endif;
// Read the results from UPSPXRS. A selection of the available fields
// is output by the example program, but more are available - review
// the file to see what else is available.
reade UniqueID UPSPXRS.RUPSPXRS PXRS;
dow not %Eof(UPSPXRS);
WriteToJobLog( 'Result Record:' + NewLine );
WriteToJobLog( 'UID: ' + %Char(PXRS.UID) + NewLine );
WriteToJobLog( 'PKTYPE: ' + PXRS.PKTYPE + NewLine );
reade UniqueID UPSPXRS.RUPSPXRS PXRS;
enddo;
endif;
exsr cleanup;
return;
begsr cleanup;
// Always call UPS_cleanup() any time your program will terminate
UPS_cleanup();
*INLR = *ON;
endsr;
/END-FREE
Data Structures
|
|
|
Error code raised by subprocedure |
|
Severity of error - will be either UPS_SEVERE or UPS_INFO |
|
Name of subprocedure that raised the error |
|
Error message text |
Input Table Files
|
Record Pickup Cancel Request Record |
|
Key Record Unique ID |
|
UPS User ID |
|
UPS Account Number |
|
Pickup Request Number |
|
Cancel By Valid Values:
|
Output Table Files
|
Record Pickup Cancel Response Record |
|
Key Record Unique ID |
|
Pickup Type |
|
GWN Code |
|
GWN Description |