Easytrieve Sales Reporting Projects

Sales reporting is among the most visible Easytrieve workloads in retail and wholesale organizations. Store managers expect a daily listing of transactions by register; regional directors expect district rollups by the 6 a.m. deadline; finance expects net sales to tie to general ledger posting from the same business date. Easytrieve reads consolidated transaction extracts—often millions of rows per night—and produces formatted reports with control breaks, category decodes, and hash totals operators sign off before email distribution. This tutorial explains typical sales file layouts, how to calculate extended amounts and discounts, store and region subtotals, daily versus monthly calendar logic, comparison to prior periods, exception handling for bad store codes, and JCL patterns that fit the retail batch window.

Progress0 of 0 lessons

Sales Transaction Extract Layout

Upstream consolidation jobs merge register tapes, e-commerce orders, and returns into one sequential extract. Easytrieve FILE definition must match copybook picture exactly—especially signed quantity on returns and implied decimal on currency fields.

text
1
2
3
4
5
6
7
8
9
10
FILE SALETRN STORE-ID 5 NUM REG-NO 3 NUM TRAN-DATE 8 NUM SKU-NO 12 A QTY-SOLD 7.0 UNIT-PRICE 7.2 DISC-AMT 7.2 NET-AMT 9.2 DEPT-CODE 3 NUM

STORE-ID identifies physical or virtual store. REG-NO is register or lane number for detail audit. TRAN-DATE is CCYYMMDD or shop-specific date format—filter consistently in IF statements. QTY-SOLD may be negative on returns. NET-AMT might be calculated upstream or in Easytrieve as QTY-SOLD times UNIT-PRICE minus DISC-AMT; pick one authoritative source to avoid double subtraction.

Calculate Net Sales in JOB

text
1
2
3
4
5
6
7
8
9
10
11
12
JOB INPUT SALETRN IF TRAN-DATE NE W-RUN-DATE GOTO JOB END-IF EXT-AMT = QTY-SOLD * UNIT-PRICE NET-LINE = EXT-AMT - DISC-AMT ADD NET-LINE TO W-TOTAL-NET ADD 1 TO W-TRAN-CNT SEARCH STORETAB WITH STORE-ID GIVING STORE-NAME IF NOT STORETAB PERFORM LOG-STORE-EXCEPTION END-IF

W-RUN-DATE comes from PARM, system variable, or control file. GOTO JOB skips records outside the reporting day when extract carries multiple dates. W-TOTAL-NET feeds TITLE trailer for finance tie-out. STORETAB TABLE decodes store id to printable name on detail and break lines.

Report Types and Audiences

Common sales reports built with Easytrieve
ReportAudienceTypical break level
Daily store register listingStore managerStore, then register
District sales summaryRegional directorDistrict code
Department performanceMerchandisingDepartment code
SKU top sellersBuying teamSKU with sort by amount descending
Exception — unknown SKU or storeMaster data teamNone — flat exception list

Control Breaks for Regional Rollups

SORT SALETRN by DISTRICT-CODE, STORE-ID before Easytrieve when district is not on every transaction row—often merged from store master in upstream job. REPORT defines BREAK DISTRICT-CODE with AFTER-BREAK printing district net sales and transaction count. Nested break on STORE-ID within district appears on detailed district reports; summary-only jobs break at district alone.

text
1
2
3
4
BREAK DISTRICT-CODE AFTER-BREAK PRINT DISTRICT-SUMMARY-LINE W-DIST-NET = ZERO W-DIST-CNT = ZERO

Accumulators W-DIST-NET increment inside JOB for each transaction in the current district group. AFTER-BREAK resets them when district changes. Grand totals accumulate in separate W-GRAND-NET fields updated on every record regardless of break.

Daily Versus Monthly Reporting

Daily jobs

Filter single TRAN-DATE equal to business date. Run after POS close—often 2 a.m. to 5 a.m. Tight window demands efficient SORT and minimal TABLE lookups. Title lines show Daily Sales Report and formatted date mask.

Monthly jobs

Filter TRAN-DATE between W-MONTH-START and W-MONTH-END inclusive. May include adjustment transactions posted on last day of month with special TRAN-TYPE code. Finance expects monthly report net to match GL revenue account for the period—document whether report uses transaction date or posting date when they differ.

Department and Category Decodes

DEPT-CODE on transaction ties to merchandising hierarchy. SEARCH DEPTTAB WITH DEPT-CODE GIVING DEPT-NAME for readable columns. Category rollups may map many SKUs to class through ITEMTAB TABLE keyed by SKU-NO returning CLASS-CODE then second SEARCH on CLASSTAB. Chain lookups in DECODE-SALES-FIELDS. PROC keep JOB readable.

Returns and Voids

Negative QTY-SOLD or TRAN-TYPE codes V and R identify returns and voids. Policy decides whether returns appear on same report as sales or separate Returns Register. IF TRAN-TYPE EQ R route to PERFORM PROCESS-RETURN accumulating W-RETURN-TOT separately from W-SALES-TOT so executives see gross versus net clearly.

Comparison and Trend Reports

Year-over-year district report reads merged file with CURR-AMT and PRIOR-AMT per store or computes PRIOR from second input FILE with MATCH on STORE-ID in advanced designs. VARIANCE equals CURR minus PRIOR; VAR-PCT equals variance divided by PRIOR with zero-divide guard in IF PRIOR NE ZERO. These reports support budgeting meetings; parallel-run against spreadsheet before first production month-end.

Control Totals and Sign-Off

  • W-TRAN-CNT matches upstream transaction trailer count.
  • W-TOTAL-NET matches finance daily sales control report.
  • Sum of district subtotals equals grand total on report.
  • Exception count W-BAD-STORE-CNT documented on run sheet.

Sample JCL

text
1
2
3
4
5
6
7
//DAYSALES EXEC PGM=EZTPA00,REGION=0M //SYSPRINT DD SYSOUT=* //SYSIN DD DSN=RTL.LIB(EZTDAYSL),DISP=SHR //SALETRN DD DSN=RTL.SALES.DAILY(+1),DISP=SHR //STORETAB DD DSN=RTL.STORE.MASTER,DISP=SHR //RPTOUT DD SYSOUT=(1,INTRDR) //EXCEPT DD DSN=RTL.SALES.EXCEPT(+1),DISP=(,CATLG,DELETE)

Performance at Retail Volume

High-volume chains process tens of millions of transactions nightly. Presort extracts in dedicated SORT step with sufficient workspace. Merge store master before Easytrieve to avoid per-row SEARCH on large STORETAB. Split by region into parallel jobs when single run exceeds window; combine control totals in downstream control job.

Explain It Like I'm Five

Sales reporting is like counting every lemonade stand sale at the end of the day. Each receipt is a line. Easytrieve adds up how much each stand sold, then how much each neighborhood sold, then the whole city. If a receipt has a stand number nobody recognizes, it goes on a fix-this list instead of the main total so the mayor is not confused.

Exercises

  1. Define SALETRN FILE and filter TRAN-DATE equal to a test date.
  2. Calculate NET-LINE and accumulate W-TOTAL-NET with trailer TITLE.
  3. Design district control break with AFTER-BREAK summary line.
  4. Build STORETAB INSTREAM with three stores and handle IF NOT STORETAB.
  5. List three control totals finance would compare before approving report release.

Frequently Asked Questions

Quiz

Test Your Knowledge

1. Sales reporting Easytrieve jobs most often read:

  • Point-of-sale or order transaction extracts
  • Compiler listing files
  • CICS map source
  • JCL procedure libraries only

2. Regional sales subtotals typically use:

  • Control breaks on region or district code
  • SCREEN INPUT
  • MACRO without FILE
  • STOP RUN

3. Extended sales amount is usually calculated as:

  • Quantity times unit price minus discounts
  • Page count times line count
  • Record length times block size
  • TITLE line number

4. Daily versus monthly sales reports differ mainly in:

  • Date filter range and aggregation period
  • Compiler version
  • FILE TABLE keyword
  • PF key assignment

5. Unknown store code on a transaction should:

  • Route to exception report and exclude from trusted totals
  • Add to largest region silently
  • Delete the transaction record
  • Skip SORT step
Published
Read time19 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Mainframe retail sales batch reporting patterns with EasytrieveSources: Broadcom Easytrieve 11.6 batch reporting, retail operations practicesApplies to: Easytrieve daily and monthly sales reporting projects