OUTFIL Converting FB to VB
OUTFIL statement is used to convert a Fixed Blocked (FB) file to a Variable Blocked (VB) file. FB files have fixed-length records, while VB files have variable-length records (each record can have a different length).
In VB files, each record includes a Record Descriptor Word (RDW) in the first four bytes, which sets the length of the record.
FTOV parameter used to convert FB file to a VB file with OUTFIL's. PARSE BUILD, OUTREC, OVERLAY, FINDREP, or IFTHEN parameters can be used with FTOV on the OUTFIL statement.
Syntax -
//SYSIN DD *
OUTFIL FNAMES=DDname,FTOV
/*
DDname | It is eight character's name that representing the actual file. |
FTOV | Specifies convert from FB to VB. DFSORT adds the RDW after the FB record is reformatted. |
Examples -
Assume input file is FB and output file is VB.
Scenario1 - Basic Conversion from FB to VB
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL BUILD=(5,96)
/*
No sorting is done; the records are copied from the input to the output. The output dataset is defined as Variable Blocked (VB). The logical record length is set to 100, meaning the maximum length of each record can be up to 100 bytes.
Scenario2 - FB to VB with Specific Fields
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL BUILD=(1,10,20,30)
/*
This copies the first 10 bytes starting from position 1 and the next 30 bytes starting from position 20 of the FB input record into the VB output record. The RDW will automatically be placed at the beginning of each VB record by DFSORT.