Easytrieve Invoice Generation Projects

Invoice generation transforms billing detail and customer master data into documents customers pay—whether paper, PDF, or electronic presentment. On the mainframe, Easytrieve has long formatted invoice registers, print tapes for commercial printers, and summary reports for accounts receivable clerks. A typical job reads unbilled or cycle billing extract, merges customer name and address, accumulates line items per invoice number, calculates tax and discounts, writes fixed-column print records, and produces control totals finance compares to AR posting. This tutorial walks through billing file layouts, master merge patterns, invoice control breaks, tax calculation modules, print record design, duplicate and reprint handling, and operational controls for high-volume billing cycles.

Progress0 of 0 lessons

Billing Detail File Layout

text
1
2
3
4
5
6
7
8
9
10
FILE BILLDET CUST-ID 9 NUM INVOICE-NO 12 A INV-DATE 8 NUM LINE-NO 3 NUM PROD-CODE 10 A QTY 7.0 UNIT-PRICE 9.2 LINE-AMT 9.2 TAX-FLAG 1 A

CUST-ID links to customer master. INVOICE-NO groups line items—multiple rows share same invoice number. LINE-NO sequences items on the invoice. LINE-AMT may be pre-calculated upstream or computed as QTY times UNIT-PRICE in Easytrieve. TAX-FLAG Y marks taxable lines for jurisdiction rules in CALC-TAX module.

Customer Master Merge

Customer master carries bill-to name, address lines, tax id, payment terms, and remit-to address. Merge patterns: pre-sorted merge in JCL producing wide billing file, or SEARCH CUSTTAB TABLE WITH CUST-ID at invoice break reading master fields into header buffer when INVOICE-NO changes.

text
1
2
3
4
5
6
7
8
9
10
11
12
JOB INPUT BILLDET IF INVOICE-NO NE W-SAVE-INV AND W-SAVE-INV NE SPACES PERFORM EMIT-INVOICE-TRAILER END-IF IF INVOICE-NO NE W-SAVE-INV PERFORM LOAD-CUSTOMER-HEADER PERFORM EMIT-INVOICE-HEADER W-SAVE-INV = INVOICE-NO W-INV-SUB = ZERO END-IF PERFORM EMIT-LINE-DETAIL ADD LINE-AMT TO W-INV-SUB

Invoice Control Break Logic

Input must be sorted by INVOICE-NO (and LINE-NO within invoice). When invoice changes, trailer record emits subtotal, tax, and total due. W-INV-CNT counts invoices for register. Grand totals W-GRAND-BILLED accumulate all invoice totals for control report.

Invoice job output artifacts
OutputConsumerContent
Print filePrint vendor / AFPHeader, lines, trailer per invoice
Invoice registerAR supervisorOne line per invoice with amount
Exception fileBilling clerksMissing master, zero amount, bad tax code
Control reportFinanceCount and sum tie-out

Tax and Discount Calculation

PERFORM CALC-TAX after line accumulation reads customer ship-to state from master, applies rate from TAXTAB TABLE or fixed constants per state code. Taxable lines only when TAX-FLAG EQ Y. Document rounding—line-level versus invoice-level tax rounding affects penny tie-out with billing engine. Discount modules apply terms percent or flat credit lines with negative LINE-AMT.

Print Record Layout

Print vendor specifications define record types: H header, D detail, T trailer with fixed column positions. MOVE fields into OUT-REC buffer; WRITE PRINTFILE. Mask account numbers on customer-facing lines. Include barcode field if vendor prints remittance stub—barcode often encodes INVOICE-NO and amount check digit computed in PERFORM BARCODE-RTN.

text
1
2
3
4
5
6
7
8
9
EMIT-LINE-DETAIL. PROC OUT-REC-TYPE = 'D' OUT-PROD = PROD-CODE SEARCH PRODTAB WITH PROD-CODE GIVING OUT-DESC OUT-QTY = QTY OUT-PRICE = UNIT-PRICE OUT-EXT = LINE-AMT WRITE PRINTFILE END-PROC

Validation Before Print

  • Customer master missing for CUST-ID—hold invoice on exception file.
  • Zero or negative invoice total after lines—policy may suppress print.
  • Duplicate INVOICE-NO in same cycle—possible rebill; route to supervisor report.
  • Address line exceeds print field width—truncate with audit flag or exception.
  • Tax jurisdiction unknown—default zero tax with exception for compliance review.

Reprint and Duplicate Suppression

Rebill jobs read REPRINT-REQUEST file listing INVOICE-NO values to regenerate. IF INVOICE-NO not on request file GOTO JOB when running reprint-only cycle. Duplicate suppression compares against PRIOR-INV-FILE hash set or calls indicator from billing system on detail row BILL-STATUS already printed.

Sample JCL

text
1
2
3
4
5
6
7
8
//INVGEN EXEC PGM=EZTPA00,REGION=0M //SYSPRINT DD SYSOUT=* //SYSIN DD DSN=AR.LIB(EZTINV01),DISP=SHR //BILLDET DD DSN=AR.BILL.CYCLE(+1),DISP=SHR //CUSTMAST DD DSN=AR.CUSTOMER.MASTER,DISP=SHR //PRINTFIL DD DSN=AR.INV.PRINT(+1),DISP=(,CATLG,DELETE) //INVREG DD SYSOUT=(1,INTRDR) //EXCEPT DD DSN=AR.INV.EXCEPT(+1),DISP=(,CATLG,DELETE)

High-Volume Billing Cycles

Monthly utility and telecom bills may reach millions of invoices. Split by customer region or invoice prefix into parallel Easytrieve steps; merge print files afterward. Avoid per-line SEARCH on huge product catalog—merge descriptions in upstream extract. Tune REGION and SORT workspace in JCL chain preceding invoice step.

Explain It Like I'm Five

Invoice generation is like filling out numbered bills for every customer who bought something. Each bill lists what they bought and the prices. Easytrieve copies their name and address from the address book, adds up each bill, adds tax if needed, and puts all the bills in a stack for the mail room. A cover sheet lists how many bills and how much money total so the grown-ups check the math.

Exercises

  1. Define BILLDET and implement invoice number change detection with W-SAVE-INV.
  2. Write EMIT-INVOICE-TRAILER. PROC accumulating W-INV-SUB and tax.
  3. Design exception rule for missing customer master.
  4. Sketch print record types H, D, T and fields each carries.
  5. List control totals AR supervisor compares before releasing print file.

Frequently Asked Questions

Quiz

Test Your Knowledge

1. Invoice generation jobs typically merge:

  • Billing detail with customer master for name and address
  • Compiler options with JCL
  • CICS maps with SCREEN only
  • SORT control cards only

2. Invoice line items are often grouped by:

  • Invoice number control break
  • Random record order
  • PAGE count
  • MACRO name

3. Tax amount on invoices usually applies:

  • Documented rate to taxable line amounts per jurisdiction
  • Flat TITLE text
  • Record length
  • SYSPRINT line count

4. Print-ready invoice output is typically:

  • Fixed-column sequential file for print vendor or laser stream
  • HTML only
  • Undocumented binary
  • SCREEN map

5. Invoice register control totals include:

  • Invoice count and total billed amount
  • Only page numbers
  • Compiler listing lines
  • PF key count
Published
Read time19 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Mainframe accounts receivable invoice batch with EasytrieveSources: Broadcom Easytrieve 11.6 batch file and report processingApplies to: Easytrieve invoice generation and billing print file projects