Mainframe estates outlive applications. A vendor upgrade changes customer master from 200-byte fixed records to 350-byte layout with new date fields. A merger brings ASCII extracts that must become standard company EBCDIC sequential files. A regulatory change demands account numbers expand from nine digits to sixteen. File conversion projects are the bridge—and Easytrieve is a practical tool for them because READ-WRITE loops, MASK formatting, TABLE lookups, and exception reports live in one program. This tutorial walks through real conversion scenarios: legacy-to-new layout mapping, packed decimal handling, date format migration, header and trailer records, validation during convert, parallel run discipline, and JCL patterns operations schedule nightly until cutover completes. Beginners should pair this page with the file copy utility and validation framework design patterns for reusable COPY and VALIDATE PROCs that conversion jobs share across dozens of interface files.
| Phase | Deliverable | Easytrieve role |
|---|---|---|
| Specification | Old vs new field map | Library DEFINE for both layouts |
| Build | CONVERT JOB program | JOB INPUT, transform, WRITE |
| Test | Sample file parity | ERROR-FILE for rejects |
| Parallel | Dual pipeline counts | Statistics DISPLAY in TERM |
| Cutover | Single authoritative target | Production JCL switch |
Define OLD-RECORD and NEW-RECORD field lists in Library with explicit positions and types. Conversion clarity demands separate FILE statements for SOURCE and TARGET even when both are sequential—different LRECL values. Map field by field in CONVERT-RECORD PROC; document unmapped legacy filler as spaces in new layout. When old field splits into two new fields—combined name becomes FIRST and LAST—use PARSE or substring MOVE per release grammar.
1234567891011FILE SOURCE-FILE SEQUENTIAL 200 OLD-ACCT 1 9 N OLD-NAME 10 30 A OLD-BAL 40 7 P 2 END-FILE FILE TARGET-FILE SEQUENTIAL 350 NEW-ACCT 1 16 A NEW-NAME 17 46 A NEW-BAL 47 15 N 2 END-FILE
1234567891011121314151617JOB INPUT SOURCE-FILE ADD 1 TO READ-COUNT PERFORM CONVERT-RECORD IF VAL-STATUS NE ZERO PERFORM WRITE-ERROR ELSE WRITE TARGET-FILE ADD 1 TO WRITE-COUNT END-IF END-JOB CONVERT-RECORD. PROC MOVE OLD-ACCT TO NEW-ACCT MOVE OLD-NAME TO NEW-NAME MOVE OLD-BAL TO NEW-BAL PERFORM VALIDATE-CONVERTED END-PROC
VALIDATE-CONVERTED checks mandatory new fields—non-blank account, balance within range—before WRITE. Leading-zero account expansion might PERFORM PAD-ACCOUNT moving OLD-ACCT into sixteen-character NEW-ACCT with MASK.
Legacy files store dates as YYMMDD packed, Julian YYDDD, or MMDDYY display. New systems expect CCYYMMDD display or ISO strings. Conversion PROC holds intermediate WORK-DATE fields; use date functions documented in date functions tutorial—never assume implicit conversion. Document century expansion rule for YY years—70–99 map to 1970–1999 versus 2070–2099 per shop policy. Wrong century breaks age calculations downstream for decades.
Legacy status codes A/B/C map to new codes 01/02/03. Load CODE-XREF TABLE in INIT-JOB; SEARCH in CONVERT-RECORD sets NEW-STATUS from OLD-STATUS. Unmapped codes set VAL-STATUS and ERROR-FILE row—do not default silently to zero unless spec allows. TABLE-driven conversion survives code set changes without recompiling IF ladders when operations maintain TABLE file.
IF RECORD-TYPE = 'H' on first row: WRITE new-format header with conversion run date and source file identifier; skip or transform per spec. Some conversions strip old headers and write new standard header only once in INIT-JOB.
Accumulate WRITE-COUNT and amount sums in JOB; at EOF after detail loop, PERFORM WRITE-TRAILER moving counts to new trailer layout. Downstream validation jobs compare trailer to detail—missing trailer is cutover blocker.
| DD | Purpose |
|---|---|
| SOURCE | Legacy file DISP=SHR |
| TARGET | New file DISP=(NEW,CATLG) with correct LRECL |
| ERRORS | Reject file for reprocessing |
| SYSOUT | Conversion statistics log |
Billion-record conversions run overnight—minimize DISPLAY per record, use adequate BLKSIZE, consider splitting by key range with multiple JCL steps if restart required. Pure byte copy without transform may stay with IEBGENER; Easytrieve earns its cost when every record needs logic. Profile elapsed time on ten-percent sample before full production volume.
Your toy box has labels in one color sticky notes; the new box wants different color notes with more words. File conversion is moving each toy and rewriting the label to fit the new box rules. Broken toys go in a reject pile instead of the new box. Grown-ups count toys in both boxes to make sure none got lost before throwing away the old box.
1. File conversion Easytrieve jobs primarily:
2. Packed decimal to display numeric conversion uses:
3. Conversion cutover parallel run compares:
4. Variable-length to fixed-length conversion requires:
5. Trailer record on converted file often: