COBOL programmers expect an explicit OPEN before READ or WRITE. Easytrieve beginners search the Language Reference for OPEN and often find CLOSE instead. Broadcom Easytrieve Report Generator 11.6 opens files implicitly: JOB activities with automatic input open files before the read loop; other files open on first I/O unless FILE DEFER delays them. This tutorial uses OPEN as the lifecycle topic name in the statements index because operations teams still describe when a dataset becomes available for processing. Understanding implicit open prevents mistakes with START procedures, SQL SELECT timing, TABLE external loads, and multi-pass FILE processing paired with CLOSE. This page teaches automatic JOB open sequence, DEFER semantics, processing mode detection, reopen after CLOSE, restrictions on automatic files, and JCL DD coordination at open time.
Easytrieve scans I/O statements in each activity and opens files with appropriate processing mode before executing them. You declare files in Library with FILE; activity logic references them with GET, READ, PUT, WRITE, or automatic JOB INPUT. The runtime issues open equivalent when needed. Legacy CA-Easytrieve Plus documentation sometimes discussed explicit open verbs; modern Report Generator centers on automatic behavior documented in File Processing Modes chapter.
12JOB INPUT PERSNL NAME PAYROLL * record logic here
Broadcom documents implied execution: if START procedure exists, PERFORM it after open; retrieve input; on EOF run FINISH if present and wrap reports; else perform record logic and loop. Files required for automatic input and referenced outputs open before START runs. This is why INIT logic in START sees open files but must not READ automatic input file manually with GET.
| Step | Action |
|---|---|
| JOB begins | Open files needed for activity |
| START PROC | PERFORM if coded |
| Read loop | Automatic read until EOF |
| Per record | User JOB logic executes |
| EOF | FINISH PROC, report wrap, next activity |
Programs without JOB INPUT on a file still open that file when first GET, READ, PUT, or WRITE executes. Multi-file jobs mixing manual GET on secondary files open each file on its first use. Processing mode—input, output, update—derives from which verbs appear in the activity per File Processing Modes chapter.
123456FILE PERSNL SQL (PERSONNEL) DEFER JOB NAME RETRIEVE INPUT PERSNL START START-PROC START-PROC. PROC SELECT FROM PERSNL WHERE WORKDEPT = 921 END-PROC
Without DEFER, default SQL SELECT may open during initialization before START runs, then close and reopen when START issues SELECT—wasted work. DEFER delays open until SELECT in START executes. Apply same pattern when TABLE external load should follow working storage setup in START.
CLOSE file-name ends access before activity ends. Next I/O on that file reopens it—functionally replacing explicit OPEN for multi-pass processing. Pair CLOSE with second pass GET or JOB INPUT restart patterns carefully; automatic input files cannot be CLOSE targets per CLOSE restrictions.
FILE CREATE and NOVERIFY parameters affect VSAM open behavior at implicit open time. RESET on CREATE reloads file; missing REUSE on occupied VSAM causes open error. Operations correct JCL DD allocation before rerunning—application logic rarely catches open failures unless file status fields are defined and tested after first I/O.
| I/O verbs in activity | Typical mode |
|---|---|
| GET only | Input sequential |
| PUT only | Output |
| GET and WRITE UPDATE | Update with browse |
| READ keyed | Direct indexed access |
FILE UPDATE parameter and verb mix must agree. Invalid combinations fail at compile or first open depending on checks. Document team standards for indexed update jobs to avoid opening for wrong access.
Open binds Library file-name to DD statement in JCL at runtime. Missing DD, wrong DSN, or DCB mismatch surfaces at open—not at compile. Developers test with production-like JCL classes. STEPLIB must resolve Easytrieve runtime before any file open in executed step.
123JOB INPUT NULL NAME MANUAL-ONLY GET MYFILE * manual read loop logic
INPUT NULL prevents automatic read loop—you control all input with GET or READ. Open still occurs on first GET. Use when multiple input sources or complex browse patterns replace simple JOB INPUT sequential model.
Open is when the computer connects your program to the filing cabinet drawer. Easytrieve opens drawers automatically when you start reading or when the JOB begins—it does not make you say open out loud. DEFER is waiting to open the drawer until you actually reach for a file. CLOSE shuts the drawer early; next time you reach, it opens again. JCL is the list on the wall saying which drawer number belongs to your program today.
1. Easytrieve 11.6 typically opens files:
2. FILE DEFER delays open until:
3. JOB INPUT PERSNL implies before first record:
4. After CLOSE FILEA next GET on FILEA:
5. SQL FILE without DEFER before START PROC SELECT: