Inventory management on the mainframe means tracking what you have, where it sits, and when to order more—often across hundreds of warehouses and millions of SKUs. ERP systems publish nightly stock balance extracts and movement transaction files; Easytrieve turns those datasets into warehouse stock listings, below-minimum reorder reports, dead-stock analysis, shrink exception lists, and vendor return summaries. Retail, manufacturing, and distribution share the same batch patterns even when field names differ. This tutorial covers typical inventory file layouts, SKU master lookups, reorder logic, location control breaks, movement history reports, negative quantity validation, and how inventory jobs fit the nightly supply chain batch window.
| File | Contents | Report use |
|---|---|---|
| Stock balance | SKU, location, on-hand qty, allocated qty | Snapshot listings, reorder checks |
| Item master | SKU, description, unit cost, reorder point | Decode and threshold comparison |
| Movement history | SKU, location, transaction type, qty, date | Activity audit, shrink tracing |
| Location master | Warehouse code, name, region | Break headings and regional rollups |
123456FILE STKBAL SKU-NO 12 A WHS-CODE 4 A ON-HAND-QTY 9.0 ALLOC-QTY 9.0 AVAIL-QTY 9.0
SKU-NO identifies product; WHS-CODE identifies warehouse or store location. ON-HAND-QTY is physical count; ALLOC-QTY is reserved for orders; AVAIL-QTY may be calculated upstream or in Easytrieve as ON-HAND minus ALLOC. Numeric definitions match ERP extract—integer quantities often use zero decimal positions.
Balance files often carry SKU without description. Two patterns prevail: merge item master to balance in upstream sort/merge JCL producing wide extract, or SEARCH SKUTAB TABLE WITH SKU-NO GIVING SKU-DESC in Easytrieve. Merge once saves repeated SEARCH on high-volume runs; TABLE suits small catalogs or when master changes independently mid-day via refreshed table dataset.
12345678910111213FILE SKUTAB TABLE 100 DISK ARG 12 A DESC 40 A JOB INPUT STKBAL SEARCH SKUTAB WITH SKU-NO GIVING SKU-DESC IF NOT SKUTAB SKU-DESC = 'UNKNOWN SKU' PERFORM LOG-SKU-EXCEPTION END-IF IF ON-HAND-QTY LT ZERO PERFORM LOG-NEGATIVE-STOCK END-IF
Purchasing needs SKUs where available quantity falls below reorder point from item master. When master fields appear on merged extract, compare directly; otherwise SEARCH or second FILE read supplies REORDER-PT threshold per SKU.
1234567JOB INPUT STKBAL PERFORM GET-REORDER-THRESHOLD IF AVAIL-QTY LT REORDER-PT ORDER-QTY = REORDER-PT - AVAIL-QTY + SAFETY-STOCK PRINT REORDER-LINE W-REORDER-CNT = W-REORDER-CNT + 1 END-IF
ORDER-QTY calculation varies by policy—economic order quantity modules may live in PERFORM GET-ORDER-QTY. SAFETY-STOCK constant buffers lead time. W-REORDER-CNT appears on report trailer for buyers verifying action list size.
Logistics managers want subtotals per warehouse: SKU count, total units, total extended cost. SORT STKBAL by WHS-CODE before Easytrieve step. REPORT defines BREAK WHS-CODE with AFTER-BREAK printing summary line. SEARCH WHSTAB for warehouse name on break heading.
1234BREAK WHS-CODE AFTER-BREAK PRINT WHS-SUMMARY-LINE W-WHS-SKU-CNT = ZERO W-WHS-UNIT-TOT = ZERO
Movement files support shrink investigation and audit. Filter IF TRAN-TYPE EQ 'ADJ' and ABS(TRAN-QTY) GT threshold for adjustment exception report. Date range filters use IF TRAN-DATE GE W-START-DATE AND TRAN-DATE LE W-END-DATE for period activity listing. Accumulate receipts versus shipments by TRAN-TYPE category for warehouse productivity metrics.
Extended cost equals quantity times unit cost from master. DEFINE fields with matching decimals; accumulate W-TOTAL-VALUE for warehouse summary. Finance may require standard cost versus moving average—read correct cost column from master and document in header comment which valuation method the report represents.
12345678//INVREORD EXEC PGM=EZTPA00,REGION=0M //SYSPRINT DD SYSOUT=* //SYSIN DD DSN=INV.LIB(EZTREORD),DISP=SHR //STKBAL DD DSN=INV.STOCK.BAL(+1),DISP=SHR //SKUTAB DD DSN=INV.SKU.MASTER(+1),DISP=SHR //RPTOUT DD SYSOUT=(1,INTRDR) //PURCH DD DSN=INV.REORDER.LIST(+1),DISP=(,CATLG,DELETE) //EXCEPT DD DSN=INV.STOCK.EXCEPT(+1),DISP=(,CATLG,DELETE)
PURCH DD captures machine-readable reorder list for downstream purchasing feed. EXCEPT DD captures negative stock and unknown SKU for morning inventory control meeting.
Retail emphasizes store-level SKUs, high SKU count, and shrink by location. Manufacturing emphasizes raw material versus finished goods, lot numbers, and WIP locations. Easytrieve patterns identical—FILE layouts and break levels differ. Lot-controlled environments add lot number to sort key and break hierarchy.
Millions of balance rows require presorted input, minimal DISPLAY, and single-pass accumulation. Merge SKU master before Easytrieve when SEARCH would run per row on huge catalog. Split regional jobs when one global run exceeds batch window—operations runs four parallel jobs by region with merged control totals afterward.
Inventory Easytrieve is like checking every toy box in every room of a giant store at bedtime. You count how many of each toy is in each room. If a room has fewer toys than the list says you need, you write on a shopping list to buy more. If a count is minus one—which should not happen—you tell the grown-up to fix the mistake before opening tomorrow.
1. Inventory Easytrieve jobs typically read:
2. Reorder reports flag items when:
3. SKU descriptions usually come from:
4. Warehouse reports often subtotal by:
5. Negative on-hand quantity on a stock file should: