Extract, transform, load—ETL—is the plumbing behind data warehouses, management dashboards, and regulatory reporting on the mainframe. Operational systems capture transactions; analytics needs cleaned, conformed, summarized datasets overnight. Easytrieve ETL jobs appear in banks, insurers, retailers, and government: read yesterday's extract, decode product codes through TABLE files, join customer attributes from master via keyed READ, aggregate sales by region, write star-schema-friendly flat files consumed by BI tools or downstream COBOL. This tutorial explains ETL phases in Easytrieve terms, staging discipline, transform PROC libraries, multi-target load, slowly changing dimension approximations in flat files, control totals, error isolation, and how ETL portfolios share batch processing and validation frameworks. Beginners should not confuse one-shot file conversion with ongoing ETL—the same MOVE syntax, different operational schedule, monitoring, and restart requirements.
| Phase | Easytrieve activity | Typical output |
|---|---|---|
| Extract | JOB INPUT source or GET unload | STAGE-FILE raw |
| Transform | JOB INPUT STAGE, PERFORM TRANSFORM | WORK-FILE enriched |
| Load | JOB INPUT WORK, WRITE mart files | DIM-FILE, FACT-FILE |
| Quality | REPORT exception listing | SYSPRINT audit |
Nightly copy of entire customer master to STAGE—file copy utility pattern with extract timestamp in header. Downstream transform assumes complete snapshot; deletes in source appear as missing keys in compare reports.
Source application writes change file with action code I/U/D. Extract JOB INPUT delta; transform applies upsert semantics on mart—UPDATE indexed mart file or rewrite partition sequential per design. Delta ETL reduces volume but demands strict change sequencing.
1234JOB INPUT DELTA-FILE ADD 1 TO EXTRACT-COUNT WRITE STAGE-FILE END-JOB
TRANSFORM-RECORD PERFORM chain: VALIDATE-EXTRACT, ENRICH-CUSTOMER via READ CUSTOMER-MASTER keyed by ID, SEARCH PRODUCT-TABLE for hierarchy, COMPUTE extended amount, MAP status codes. Reject records WRITE REJECT-FILE; good records WRITE WORK-FILE. Enrichment READ failures set VAL-STATUS 41—missing dimension— common ETL data quality issue tracked in daily exception report.
123456789101112131415TRANSFORM-RECORD. PROC PERFORM VALIDATE-EXTRACT IF VAL-STATUS NE ZERO EXIT END-IF MOVE CUST-ID TO MAST-KEY READ CUSTOMER-MASTER IF EOF CUSTOMER-MASTER MOVE 41 TO VAL-STATUS EXIT END-IF MOVE MAST-REGION TO OUT-REGION MOVE TRAN-AMT TO OUT-AMT COMPUTE OUT-EXT-AMT = OUT-AMT * OUT-QTY END-PROC
Fact loads sometimes need pre-aggregation—sales by store by day. SORT WORK by STORE and DATE, then JOB INPUT with CONTROL STORE DATE summing AMOUNT in REPORT—or procedural accumulation in PROC writing one output row per break. Control break processing pattern applies. Choose REPORT SUM when listing matches load layout; choose procedural when load format differs from printable detail.
| Target | Description |
|---|---|
| FACT-FILE | Transactional grains—sale lines, balances |
| DIM-FILE | Descriptive attributes—customer, product |
| BRIDGE-FILE | Many-to-many relationships |
| CONTROL-FILE | Run metadata, counts, checksums |
Easytrieve loads flat files; loading DB2 directly may use DATA LOAD after file write or SQL interface where licensed. Most mainframe ETL ends at sequential mart files ingested by other processes.
TERM-JOB DISPLAY EXTRACT-COUNT TRANSFORM-IN LOAD-COUNT REJECT-COUNT. CONTROL-FILE WRITE one summary record per run for operations dashboard. Compare to source application control report—penny and row reconciliation. Mismatch triggers error-handling hard stop before BI consumers read bad mart.
ETL JCL runs after operational close—COND on predecessor job completion. Late extracts cascade delay; document acceptable finish time. Idempotent load design lets rerun overwrite same business-date partition without duplicate facts. Business-date field in every load record—not processing date alone—for correct restatement.
ETL produces files consumed by others; reporting produces human-readable listings. Same Easytrieve skills; different outputs. Some jobs combine REPORT exception listing with ETL load in one program—REPORT on REJECT-FILE after transform phase. Keep activities separated in source for clarity even if one compile unit.
ETL is making lunch boxes for the whole school. Extract is collecting ingredients from the fridge. Transform is cutting sandwiches and peeling fruit the way each class likes. Load is putting boxes in the right classroom cubbies. Staging is a counter where ingredients sit before assembly so you do not open the fridge ten times. The lunch monitor counts boxes to make sure none were dropped.
1. Extract phase in Easytrieve ETL typically:
2. Transform phase includes:
3. Load phase writes:
4. Staging file in ETL pattern:
5. ETL control totals verify: