Example 5. Creating a self-maintaining history file

This example shows a job to allocate a PDSE history file that is named MY.HIST, and using the HFZUTIL batch utility, set the fault wrap number for to 100 while permitting the future reuse of existing fault numbers.
//UTILJOB4 JOB  ...
//IDCAMS   EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSIN DD *
  ALLOC DSNAME('MY.HIST')          -
        NEW                        -
        SPACE(10 10)               -
        CYLINDERS                  -
        RECFM(V B)                 -
        LRECL(10000)               -
        DIR(10)                    -
        DSNTYPE(LIBRARY)
/*
//RUNUTIL  EXEC PGM=HFZUTIL
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
SetMinFaultEntries(MY.HIST,100)
/*

This code creates a history file with maximum automatic free space reclamation that should never run out of space provided that the data set allocation is sufficient to hold the minimum number of faults as per the SetMinFaultEntries specification.

You might also want to add a SETFAULTPREFIX control statement to your history file creation jobs (see SETFAULTPREFIX control statement) to make fault IDs in each new history file unique.