OUTFIL Creating multiple identical copies


The OUTFIL statement is used to create multiple identical copies of the same file. The known reason behind multiple file creation is backups. The FNAMES parameter identifies the DD statements for output files by their DDnames in JCL.

Syntax -

//SYSIN DD * 
   OPTION COPY
   OUTFIL FNAMES=(DDname1, DDname2,…..,DDname-n)
/*
DDname1...DDname-nIt is eight character's name that represents the actual file

Examples -


Scenario1 - Creating Two Identical Copies with the DDnames (OUTCOPY1, OUTCOPY2).

//SYSIN   DD  *
  SORT FIELDS=COPY
  OUTFIL FNAMES=(OUTCOPY1, OUTCOPY2)
/*

Copies the input file without any sorting, the first identical copy of the input file, and the second identical copy of the input file.

Scenario2 - Identical Copies with Reformatting with DDnames (COPY1 and COPY2).

//SYSIN   DD  *
  SORT FIELDS=COPY
  OUTFIL FNAMES=COPY1,BUILD=(1,80)
  OUTFIL FNAMES=COPY2,BUILD=(1,80)
/*

Reformats the output records by selecting the first 80 bytes from each input record. Both COPY1 and COPY2 will have identical records with a length of 80 bytes.