OUTFIL Converting VB to FB


OUTFIL statement is used to convert a Variable Blocked (VB) file to a Fixed Blocked (FB) file. VB files contain variable-length records with a 4-byte Record Descriptor Word (RDW) at the start of each record, whereas FB datasets have fixed-length records without an RDW. When converting from VB to FB, the RDW is removed, and the remaining record is padded or truncated to match the fixed record length.

All of the PARSE, BUILD, or OUTREC features are available with OUTFIL's VTOF.

Syntax -

//SYSIN DD * 
   OUTFIL FNAMES=DDname,VTOF
/*
DDnameIt is eight character's name that representing the actual file.
VTOFStands for Variable To Fixed, instructing DFSORT to convert variable-length records to fixed-length records.
Note! OVERLAY, FINDREP, or IFTHEN can't code with VTOF.

Examples -


Assume input file is VB and output file is FB.

Scenario1 - Basic Conversion from VB to FB

//SYSIN   DD  *
  SORT FIELDS=COPY
  OUTFIL VTOF,BUILD=(5,76)
/*

This copies 76 bytes starting from position 5 in the VB record (after the RDW) into the output FB record. Since the RDW occupies the first 4 bytes of each VB record, you start copying from position 5.

Scenario2 - VB to FB Conversion with Padding

//SYSIN   DD  *
  SORT FIELDS=COPY
  OUTFIL VTOF,BUILD=(5,80,81:X'40')
/*

Copies 80 bytes starting from position 5 of the VB record (after the RDW). Pads the remaining positions (from position 81 onward) with hexadecimal X'40', which represents a space in EBCDIC. This is necessary if the input record is shorter than the fixed length.