SQL queries relational tables; Easytrieve traditionally queries flat files record by record. On modern mainframes the boundary blurs—Easytrieve Plus reads Db2 through SQL FILE, and SQL exports feed Easytrieve anyway. This page clarifies when to use each approach and how hybrid architectures combine them without duplicating business rules.
SQL thinks in tables, rows, columns, joins, and set operations. Easytrieve FILE thinks in record layouts—fields at byte positions, control breaks on sorted files, detail lines on paper. Mainframe history left both paradigms in production: Db2 for applications, sequential extracts for reporting because batch posting still emits tapes and files.
| Aspect | Easytrieve (file/report) | SQL (Db2, etc.) |
|---|---|---|
| Data model | Record-oriented files | Normalized relational tables |
| Primary operation | Read loop, CONTROL, PRINT | SELECT, JOIN, GROUP BY |
| Output style | Formatted report pages | Result sets, exports, cursors |
| Ad hoc exploration | Requires program edit/compile | Interactive SPUFI, QMF, Data Studio |
| Transactions | COMMIT in Plus SQL contexts | Native INSERT/UPDATE/DELETE with ACID |
| Legacy fit | Decades of file-based reports | Modern apps and warehouses |
Easytrieve Plus blurs the line by declaring SQL tables as FILEs. Broadcom 11.x automated much SELECT/INTO list construction. You can mix SQL FILE input with REPORT formatting— relational data, report generator output semantics.
Conceptual pattern (simplified—not exact syntax for all releases):
123456789FILE POLICY-SQL SQL TABLE POLICY_TABLE POL-NUM ... POL-PREMIUM ... REPORT PREMIUM-RPT LINE POL-NUM POL-PREMIUM IF POL-PREMIUM > 5000 PRINT END-IF
POLICY-SQL maps to a Db2 table instead of a DD dataset. Field names correspond to columns. REPORT logic stays Easytrieve. COMMIT behavior and cursor management follow Plus rules documented in Broadcom release notes—important when mixing SQL updates with reporting.
An Easytrieve report that lists high premiums by region might be expressed in SQL as:
1234SELECT REGION, POLICY_NUM, PREMIUM FROM POLICY_TABLE WHERE PREMIUM > 5000 ORDER BY REGION, POLICY_NUM;
SQL returns a result set—formatting for print, page breaks, and control totals moves to a report tool, Easytrieve, COBOL, or BI. Easytrieve embeds formatting in the same program that reads data; SQL separates retrieval from presentation unless you use SQL FILE plus REPORT.
Db2 UNLOAD or EXPORT step produces a sequential file; Easytrieve REPORT reads it. SQL owns complex joins; Easytrieve owns layout. Clear separation of concerns.
Single program reads Db2 directly and prints. Fewer steps; SQL and report logic in one compile unit. Good for moderate complexity.
Warehouse SQL feeds Power BI or similar; Easytrieve retired when print archive no longer required. Common in modernization programs.
| Scenario | Recommended approach |
|---|---|
| Data only in Db2, complex joins | SQL (export or BI); optional Easytrieve format step |
| Data in nightly flat file | Easytrieve FILE |
| Db2 data, fixed green-bar layout | Easytrieve Plus SQL FILE or SQL extract + Easytrieve |
| Ad hoc analyst exploration | SQL tools |
| Regulatory archive matching 1998 layout | Easytrieve until certified replacement |
SQL is like asking the library computer which books match your search—it works with cards in a big catalog linked together. Easytrieve is like reading a stack of checkout slips in order and highlighting the ones you care about. If the library only has slips (files), use Easytrieve. If everything is in the computer catalog (Db2), SQL asks questions faster—unless you still need the same printed list format from before.
1. SQL is best suited for:
2. Classic Easytrieve (file-based) reads:
3. Easytrieve Plus SQL FILE allows:
4. A star schema warehouse report with many joins is usually easier in:
5. Hybrid approach means: