List of Use Cases Implemented by the Program¶
The call stack consists of three components:
1. AR415.ocl36.txt: An OCL program that orchestrates the process by invoking AR415P and AR415 programs and sorting data with #GSORT.
2. AR415P.rpgle.txt: An RPGLE program that handles interactive company code input and validation.
3. AR415.rpg36.txt: An RPG III program that generates the Customer Credit Report.
Use Case Identified: - Generate Customer Credit Report: The primary use case is to produce a report listing customers' credit status, including those exceeding their credit limits, for a specified company. The report details credit limits, total amounts due, open orders, unposted amounts, and available credit, with a secondary report listing specific orders that exceed credit limits.
Only one use case is implemented, as the programs collectively focus on generating this report, with AR415P validating the company code and AR415 processing and printing the report data.
Function Requirement Document¶
Customer Credit Report Function Requirements¶
Overview¶
The generateCustomerCreditReport function produces a Customer Credit Report for a specified company, listing customers' credit details and identifying those over their credit limits. A secondary report lists specific orders exceeding credit limits. The function takes input parameters and processes data from predefined files without interactive screen input.
Inputs¶
- Company Code (
co, 2-digit numeric): Identifies the company for which the report is generated. - Cancel Flag (
kycanc, 6-character): Indicates if the process should be canceled ("CANCEL"). - Input Files:
BICONT: Company control file (company name, deletion status).ARCUST: Sorted customer file (customer number, name, total due, credit limit).ARCUSA: Alternate customer file (customer number, total due, credit limit).ARCLGR: Ledger file (customer numbers array).BBORCL: Order file (order details, amounts, over-limit status).
Outputs¶
- ARLIST Report: Primary report listing all customers with:
- Customer number, name, credit limit, total due, open orders total, unposted amount, available credit.
- Indicates customers over their credit limit.
- ARLIS2 Report: Secondary report listing orders exceeding credit limits with:
- Customer number, name, credit limit, total due, order number, unposted amount, batch number.
- Return Status: Success, invalid company, deleted company, or canceled.
Process Steps¶
- Validate Company Code:
- Check if
cois non-zero and exists inBICONT. - Verify
cois not marked as deleted (bcdel <> 'D'). - If invalid or deleted, return error status.
- Sort Customer Data:
- Use sorted
ARCUSTfile (pre-sorted by#GSORTon positions 2–9, filtering non-deleted customers and specific conditions). - Process Company Data:
- Retrieve company name (
BCNAME) fromBICONTfor report headers. - Capture system date and time for report headers.
- Process Customer Data:
- For each customer in
ARCUST(control break on customer number):- Initialize
LIMIT,OWED,ORDVAL,TRXVAL,OVERto zero. - Retrieve additional customer numbers from
ARCLGR(up to 25, skipping deleted entries). - For each customer (from
ARCLGRandARCUST): - Chain to
ARCUSAto getAXCLMT(credit limit) andAXTOTD(total due). - Add
AXCLMTtoLIMITif non-zero; addAXTOTDtoOWED. - Process
BBORCLfor matching orders (skip deleted,BLDEL = 'D'):- Add
BLTAMT(unposted amount) toTRXVALandOWED. - Add
BLOAMT(order amount) toORDVALandOWED. - If
BLOVCL = 'Y', output order details toARLIS2.
- Add
- Set
LIMIT = ARCLMTfromARCUSTifLIMIT = 0. - Add
ARTOTDtoOWED.
- Initialize
- Calculate
OVER = LIMIT - OWED. - Generate Reports:
- ARLIST: Print for each customer:
- Customer number (
ARCUST), name (ARNAME), credit limit (ARCLMT), total due (ARTOTD), open orders (ORDVAL), unposted amount (TRXVAL), available credit (OVER). - Mark "OVER CREDIT LIMIT" if
OVER < 0.
- Customer number (
- ARLIS2: Print for orders with
BLOVCL = 'Y':- Customer number, name, credit limit, total due, order number (
BLORDR), unposted amount (BLTAMT), batch number (BLBTCH).
- Customer number, name, credit limit, total due, order number (
- Include headers with company name, date, time, and page numbers.
Business Rules¶
- Company Validation:
- Company code must be non-zero, exist in
BICONT, and not be deleted (bcdel <> 'D'). - Cancel process if
kycanc = 'CANCEL'. - Customer Filtering:
- Skip deleted customers (
CGDEL = 'D'inARCLGR) and orders (BLDEL = 'D'inBBORCL). - Process only non-zero amounts (
AXCLMT,AXTOTD,BLTAMT,BLOAMT). - Credit Calculations:
LIMIT = AXCLMT(fromARCUSA) orARCLMT(fromARCUSTifAXCLMT = 0).OWED = ARTOTD + AXTOTD + BLTAMT + BLOAMT.TRXVAL = sum(BLTAMT)(unposted amounts).ORDVAL = sum(BLOAMT)(open order amounts).OVER = LIMIT - OWED; negativeOVERindicates over credit limit.- Report Output:
ARLIST: Lists all customers with credit details, marking over-limit cases.ARLIS2: Lists orders exceeding credit limits (BLOVCL = 'Y').- Reports include company name, date, time, and page numbers.
Calculations¶
- Credit Limit (
LIMIT): Sum ofAXCLMTfromARCUSAfor valid customers; defaults toARCLMTfromARCUSTif zero. - Total Owed (
OWED): Sum ofARTOTD(fromARCUST),AXTOTD(fromARCUSA),BLTAMT(unposted fromBBORCL), andBLOAMT(orders fromBBORCL). - Unposted Amount (
TRXVAL): Sum ofBLTAMTfromBBORCL. - Open Orders (
ORDVAL): Sum ofBLOAMTfromBBORCL. - Available Credit (
OVER):LIMIT - OWED; negative values trigger "OVER CREDIT LIMIT" inARLIST.
Error Handling¶
- Return "Invalid Company" if
co = 0or not found inBICONT. - Return "Company Deleted" if
bcdel = 'D'inBICONT. - Return "Canceled" if
kycanc = 'CANCEL'.