Easytrieve Temporary Files

Temporary files are scratch space: sort work, intermediate extracts, merged buffers, and trial output that should not persist after the job. Easytrieve offers two beginner-relevant patterns. First, FILE WORKFILE VIRTUAL (optionally MEMORY, DISK, or RETAIN) lets the Virtual File Manager allocate sequential storage without cataloging a production dataset. Second, ordinary FILE declarations map to JCL temporary datasets whose names start with && and whose DISP=(NEW,DELETE) removes them when the step or job ends. Confusing these with GDG generations, VSAM masters, or virtual W fields in reports causes maintenance nightmares—FILE VIRTUAL is a file attribute, not a working-storage field. This page teaches VIRTUAL syntax, RETAIN across activities, CLOSE deletion rules, JCL && SPACE sizing, SORTWRK patterns, when temporaries beat GDG (+1), security implications of scratch datasets in shared LPARs, and cleanup failures that fill DASD when DELETE does not run.

Progress0 of 0 lessons

FILE VIRTUAL — Virtual File Manager

text
1
2
3
4
5
6
7
8
9
10
11
12
13
FILE EXTRACT SEQUENTIAL FB(80 800) FILE SORTWRK VIRTUAL MEMORY FB(80 800) FILE FILTERED VIRTUAL DISK FB(80 800) JOB INPUT EXTRACT IF STATUS-CODE EQ 'A' MOVE EXTRACT-REC TO WRK-REC PUT SORTWRK END-IF JOB SORT SORTWRK USING SORTWRK JOB INPUT SORTWRK PUT FILTERED

EXTRACT is a real input DD in JCL. SORTWRK is VIRTUAL MEMORY—VFM holds records in memory until size forces spill. FILTERED is VIRTUAL DISK—spill datasets on DASD. SORT activity reads SORTWRK and writes FILTERED without a cataloged production name. Record format on VIRTUAL must match data moved in PUT buffers. VIRTUAL files use GET, PUT, SORT, and CLOSE like sequential files except allocation is product-managed.

VIRTUAL Parameters Compared

FILE VIRTUAL options
OptionEffectUse when
VIRTUAL aloneDefault VFM allocationGeneral scratch sequential
MEMORYPrefer memory-resident storageSmall to medium work files fit in memory
DISKUse spill datasetsLarge sorts exceeding memory limits
RETAINSurvive CLOSE for later activityPass work file from JOB to REPORT activity
(no RETAIN)CLOSE may delete virtual dataOne-activity scratch only

RETAIN is critical when activity one writes SORTWRK and activity two reads it after CLOSE in the first activity. Without RETAIN, CLOSE deletes and the second activity EOFs immediately. With RETAIN, you still must CLOSE appropriately between activities per program flow documentation—test multi-activity programs in SYSPRINT trace modes when available.

CLOSE and Virtual File Lifecycle

CLOSE SORTWRK on a VIRTUAL file without RETAIN releases VFM space. CLOSE chapter documents virtual file deletion semantics. Explicit CLOSE before job end is good practice when no later activity needs the file—frees memory on long batch windows. RETAIN virtual files consume resources until final CLOSE or job termination; do not RETAIN large DISK spills unnecessarily on shared systems.

JCL Temporary Datasets (&&)

text
1
2
3
4
5
6
//EXTRACT DD DSN=PROD.PAYROLL.DAILY,DISP=SHR //WORKFILE DD DSN=&&WORK1, // DISP=(NEW,DELETE,DELETE), // UNIT=SYSDA, // SPACE=(CYL,(50,10)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)

WORKFILE matches FILE WORKFILE SEQUENTIAL FB(80 800) in Easytrieve. Double ampersand names are unique per job. NEW allocates; DELETE on step or normal termination removes the dataset. PASS may forward temporaries to later steps in the same job—Easytrieve single-step jobs rarely need PASS. SPACE must handle peak PUT volume during extract phase. UNIT=SYSDA or SMS-managed unit per shop standards.

VIRTUAL Versus JCL Temporary

Choosing scratch file strategy
FactorFILE VIRTUALJCL && temporary
JCL DD requiredUsually omittedRequired with SPACE
Catalog entryNone—VFM internalUncataloged temp
Multi-activity RETAINRETAIN keywordKeep DD open across activities if same step
Sort integrationNative SORT on VIRTUALWorks with SORTWK DD conventions
Visibility to opsLess visible in 3.4Visible as && in job output

SORT Work Files

Easytrieve SORT activities often use VIRTUAL SORTWRK automatically when coded FILE SORTWRK VIRTUAL. Large extracts may need VIRTUAL DISK or explicit SPACE on JCL temporaries when site limits memory. SORT FIELDS and KEYS must reference fields defined on the virtual FILE layout. After SORT, JOB INPUT on the sorted virtual file feeds REPORT or second-pass logic. Do not point SORT at production GDG (+1) when a VIRTUAL intermediate avoids catalog clutter.

Temporary Versus GDG

GDGs retain generations for audit and downstream replay. Temporaries die at job end—use when only this job needs scratch. Nightly payroll might write GDG (+1) for auditors but use VIRTUAL for in-program sort before the final PUT to GDG. Mixing them correctly keeps catalog LIMIT chains clean.

Not the Same as Virtual Fields

Virtual W and S fields in reports are working-storage concepts—see virtual-fields tutorial. FILE VIRTUAL is a dataset. Naming SORTWRK VIRTUAL does not create a virtual rank field on PRINT. Teach new developers the vocabulary distinction early in code review.

EXIT and Special File Restrictions

EXIT user programs on FILE are invalid for SQL, IDMS, DLI per FILE chapter. VIRTUAL files support standard GET PUT paths; verify EXIT compatibility with your release if attaching exits to work files. SQL tables are never VIRTUAL—use FILE name SQL for DBMS access.

Common Temporary File Mistakes

  • Forgetting RETAIN between activities on VIRTUAL.
  • Undersized SPACE on && WORKFILE DD.
  • FB length mismatch between EXTRACT and VIRTUAL work FILE.
  • Expecting VIRTUAL data after job end—only RETAIN lasts the run.
  • Confusing FILE VIRTUAL with virtual W report fields.
  • DISP=SHR on && NEW temporary—should be NEW.

Testing Temporary File Jobs

  1. Run small extract to VIRTUAL; confirm record count before and after SORT.
  2. Multi-activity test with and without RETAIN—observe second activity EOF.
  3. Monitor region memory for VIRTUAL MEMORY on large files.
  4. Verify && dataset deleted after job completion in SDSF or job log.
  5. CLOSE explicit path—confirm no VFM leak warnings on SYSPRINT.

Explain It Like I'm Five

A temporary file is scratch paper. FILE VIRTUAL is scratch paper the Easytrieve program keeps in its own desk drawer—it throws the paper away when done unless you label RETAIN to keep it for the next chapter. JCL && is scratch paper the computer room gives you with a sticky note that says throw away when the job finishes. You would not file scratch paper in the official notebook stack (GDG) unless you need to keep it for tomorrow.

Exercises

  1. Write FILE EXTRACT sequential and FILE WORK VIRTUAL MEMORY with PUT filter loop.
  2. Add RETAIN and sketch two activities sharing WORK file.
  3. Draft JCL && DD with SPACE for 1 million 80-byte records estimate.
  4. Explain CLOSE impact on VIRTUAL without RETAIN in one paragraph.
  5. Compare VIRTUAL DISK sort versus && SORTWK for a 5 GB extract.

Quiz

Test Your Knowledge

1. FILE SORTWRK VIRTUAL creates:

  • Easytrieve Virtual File Manager temporary storage
  • Permanent GDG generation
  • SQL cursor
  • ISPF profile

2. Without RETAIN on VIRTUAL, CLOSE typically:

  • Deletes the virtual file data
  • Catalogs to GDG
  • Copies to STEPLIB
  • Opens SYSPRINT

3. JCL &&TEMPNAME with DISP=(NEW,DELETE) is:

  • A temporary dataset deleted at job end
  • A VSAM KSDS cluster
  • A GDG base
  • A STEPLIB member

4. VIRTUAL MEMORY versus DISK:

  • MEMORY prefers memory; DISK spills to dataset when needed
  • DISK is invalid on z/OS
  • MEMORY is SQL only
  • No difference

5. FILE VIRTUAL is invalid for:

  • SQL and some special file types per FILE chapter
  • All sequential jobs
  • JOB activities
  • PUT and GET
Published
Read time17 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve Report Generator 11.6 FILE VIRTUAL and z/OS temporary datasetsSources: Broadcom Easytrieve 11.6 Language Reference FILE VIRTUAL, CLOSE; IBM JCL temporary data setsApplies to: Easytrieve VIRTUAL VFM and JCL temporary file processing