Intermediate panels assume you have maintained real batch jobs—not just passed a fundamentals course. Interviewers ask about VSAM keyed access, when to SORT, how control breaks accumulate subtotals, how macros differ from PROC, and how you handle bad records without corrupting month-end totals. You may whiteboard a multi-file JOB or explain why a report subtotal does not tie. This page provides model answers at that depth, with code snippets and comparison tables interviewers expect mid-level candidates to discuss confidently. Adapt answers with examples from your resume: a reconciliation report, an inbound feed validation, or a store rollup with break levels.
FILE definition specifies organization and access: sequential pass versus keyed READ using a key field. KSDS stores records by key; random READ retrieves one record; sequential pass reads in key order when the file is opened sequentially. Wrong key field length causes wrong record or status errors. Intermediate answer: verify key position matches IDCAMS DEFINE, handle invalid key or end conditions per site standards, and mention alternate index only if you have used PATH definitions.
Sequential QSAM or VSAM sequential pass fits full-file scans—nightly extracts, bulk transform. Keyed access fits random lookup of master records during JOB INPUT when each transaction carries a key. Mixing them wrong doubles I/O: reading entire KSDS sequentially when you only need ten keys wastes window time. Interviewers want tradeoff awareness, not dogma.
| Access | Best for | Common pitfall |
|---|---|---|
| Sequential JOB INPUT | Full file scan, extracts | Processing unsorted data before break report |
| Keyed READ | Master lookup by ID | Key length or type mismatch |
| VIRTUAL scratch | Multi-pass without permanent DSN | VFM space exhaustion |
| GDG input (+1) | Daily incremental feeds | Wrong generation referenced in JCL |
SORT activity or SORT statement orders records before REPORT or WRITE when keys are wrong. External DFSORT step makes sense when many downstream jobs consume the same ordered file or when sort keys are complex merges. Internal sort adds CPU and WORK space inside the Easytrieve step—acceptable for single-consumer jobs. Intermediate answer: presort once when chain has three report programs reading the same extract; sort inside when only one program needs order and extract layout cannot change.
DUP handling determines whether duplicate sort keys appear once or multiple times in output order. Finance reports often need all duplicates; summary jobs may collapse. Know your site default and how it affects control-break subtotals. Misconfigured DUP causes missing rows or double-counted totals—classic reconcile failure interview scenario.
BREAK-LEVEL declares fields that trigger control groups—store, then department. AFTER-BREAK procedure runs when a break occurs at that level: print subtotal, reset accumulators for the next group. BEFORE-BREAK may initialize line counters or headings. Order of break levels must match sort order of input. Strong answer: input sorted by STORE-NUM then DEPT; BREAK-LEVEL 1 STORE, 2 DEPT; accumulators reset in BEFORE-BREAK at dept level and roll up to store in AFTER-BREAK.
1234567REPORT SALES-RPT BREAK-LEVEL STORE-NUM BREAK-LEVEL DEPT-CODE AFTER-BREAK. PROC PRINT SUBTOTAL-LINE END-PROC
Common causes: unsorted input for breaks, arithmetic on wrong field types, duplicate records after sort, reset logic clearing accumulators too early, or mixing net and gross amounts. Intermediate candidates describe a debug approach: SYSPRINT control counts, small test file, trace accumulators in AFTER-BREAK with limited DISPLAY, compare to SQL or spreadsheet subtotals.
Macro expands source at compile time via %MACRONAME; PROC runs at execution via PERFORM. Macros share FILE layouts across programs; PROC shares runtime logic within one program (per activity scope). Interview trap: saying macros run faster at runtime—they do not execute; they generate code before compile.
Callers must recompile to pick up new expansion. Layout change without regression compile causes offset bugs. Intermediate answer mentions change control, regression list of invoking programs, and comparing LIST output before promote—shows enterprise awareness.
Load table at job start into array (DEFINE table with OCCURS) from sequential reference file, or use LOOKUP / binary search on sorted table depending on release syntax. Map transaction code to description or rate. Discuss memory limits for huge tables versus keyed VSAM read per record tradeoff. Mid-level answer quantifies: ten thousand rows in memory OK; ten million needs different design.
INITIATION once at start; each iteration BEFORE-SCREEN prepares map data; product sends screen; AFTER-SCREEN processes input; TERMINATION at end. BEFORE-SCREEN often GETs master record; AFTER-SCREEN validates and may GOTO SCREEN to redisplay. Invalid: GOTO SCREEN in BEFORE-SCREEN per Broadcom restrictions.
Fields with RESET reinitialize before BEFORE-SCREEN each cycle. Design flags carefully so AFTER-SCREEN state is not accidentally cleared. Common bug in maintenance interviews.
Validate, increment error counter, write exception record with reason code, continue or stop based on threshold. Silent skip fails audit. Intermediate answer references validation framework pattern: PERFORM VALIDATE, branch to LOG-EXcep, SYSPRINT summary at end.
| Question | Strong short answer |
|---|---|
| BUFNO purpose? | Sequential buffer count; tune hot files only after measure. |
| WORK file in report? | Temporary space for report writer processing; watch size on big breaks. |
| CALL versus PERFORM? | CALL external load module; PERFORM internal PROC in activity. |
| LOOKUP versus READ loop? | LOOKUP searches table; READ loop loads or scans file. |
| END-IF required? | Yes for structured IF blocks; match IF/END-IF nesting. |
| TITLE versus LINE? | TITLE headings; LINE detail or summary print columns. |
Intermediate questions are like sorting trading cards by team, then team by player, and saying the team score after each team pile—if you mix the order, the scores lie. You also know when to use a stamp (macro) to print the same card back design on every pack versus when to shuffle cards during the game (PERFORM at runtime).
1. KSDS VSAM files in Easytrieve typically use:
2. Macros expand at:
3. AFTER-BREAK runs:
4. Internal SORT versus presorted input:
5. VIRTUAL files use: