UPS_pkupStatus()
This subprocedure calls the UPS Pickup Pending Status API. It reads request data from UPSPSRQ, and writes response data to UPSPSRS.
Subprocedure Prototype
|
Returns *OFF if an error occurs during processing, *ON otherwise. |
|
The ID of the record in UPSPSRQ that will be used to build the request, and under which the response data will be saved in UPSPSRS. |
|
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_pkupStatus()
* subprocedure to query the status of a pickup request.
*
* To achieve this, generate a unique ID with UPS_getUID(), and
* then populate and write a record to UPSPSRQ. Then, call
* UPS_pkupStatus(), passing in your unique ID as well as
* the other parameters shown.
*
* UPS_pkupStatus() 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 UPSPSRS physical
* file, and retrieve the result fields.
*------------------------------------------------------------------------
H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('UPSBND') OPTION(*NODEBUGIO)
FUPSPSRQ UF A E K DISK Qualified
FUPSPSRS 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 PSRQ DS LikeRec(UPSPSRQ.RUPSPSRQ:*Output)
D PSRS DS LikeRec(UPSPSRS.RUPSPSRS:*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 PSRQ;
PSRQ.UID = UniqueID;
// Populate this field with application name set up using WRKUPSAUTH
PSRQ.UserID = 'KATO_TEST';
// Populate this field with a UPS account number configured in
// file UPSCFGACCT
PSRQ.AcctNbr = '523FE3';
write UPSPSRQ.RUPSPSRQ PSRQ;
// If UPS_pkupStatus() returns *Off, an error occurred and UPS_ErrorDS
// should be reviewed to determine the cause.
if not UPS_pkupStatus( 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 UPSPSRS.RUPSPSRS;
if not %Found(UPSPSRS);
WriteToJobLog( 'ERROR: No results found in UPSPSRS' + NewLine );
exsr cleanup;
return;
endif;
// Read the results from UPSPSRS. 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 UPSPSRS.RUPSPSRS PSRS;
dow not %Eof(UPSPSRS);
WriteToJobLog( 'Result Record:' + NewLine );
WriteToJobLog( 'PID: ' + %Char(PSRS.PID) + NewLine );
WriteToJobLog( 'UID: ' + %Char(PSRS.UID) + NewLine );
WriteToJobLog( 'PKTYPE: ' + PSRS.PKTYPE + NewLine );
WriteToJobLog( 'SVCDT: ' + %Char(PSRS.SVCDT) + NewLine );
WriteToJobLog( 'PRN: ' + PSRS.PRN + NewLine );
WriteToJobLog( 'STSMSG: ' + PSRS.STSMSG + NewLine );
reade UniqueID UPSPSRS.RUPSPSRS PSRS;
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 Status Request |
|
Key Record Unique ID |
|
UPS User ID |
|
UPS Account Number |
Output Table Files
|
Record Pickup Status Response |
|
Key Parent Unique ID |
|
Key Child Unique ID |
|
Pickup Type |
|
Service Date |
|
Pickup Request Number |
|
GWN Status Code |
|
On-Call Status Code |
|
Pickup Status Message |
|
Billing Code |
|
Contact Name |
|
Pickup Reference Number |