VTOF

The VTOF utility is a tool designed to perform the conversion from VB to FB format. It is commonly used in mainframe environments, where data files are often stored in fixed-length record formats for efficiency and ease of processing. You can use OUTFIL – VTOF and BUILD or OUTREC parameters. All these PARSE, BUILD, or OUTREC features are available with VTOF. For VTOF, you specify the input positions of the VB input record (including the RDW 4 bytes), and the output columns of the FB output record (excluding the RDW 4 bytes). DFSORT does not include the RDW in the FB output records.

Note: You cannot specify OVERLAY, FINDREP, or IFTHEN with VTOF. Convert a VB file with LRECL=104 to an FB data set with LRECL=100:

  • Variable Blocked (VB) Format:
    • In VB format, records can have varying lengths, and each record is preceded by its length indicator.
    • The length indicator specifies the number of bytes in the record, allowing for flexibility in the size of each record.
  • Fixed Blocked (FB) Format:
    • In FB format, records have a fixed length, and each record occupies the same number of bytes.
    • There is no need for a length indicator, as the file structure ensures that each record has a consistent size.

Understand the VB Structure:

Before using VTOF, it is essential to understand the structure of the VB file, including the length indicators.

Backup Data:

Before performing any file conversion, it is good practice to create a backup of the original VB file to avoid data loss.

Execute the VTOF Command:

Use the VTOF command, specifying the input VB file and the desired output FB file.

Review the Converted File:

After the conversion, review the newly created FB file to ensure that the records now have a fixed length.

Verify Data Integrity:

Perform data integrity checks to ensure that the conversion did not introduce errors or discrepancies.

Adjust Record Lengths (If Necessary):

Depending on the system or application requirements, you may need to adjust the record lengths in the converted FB file.

Update Application References:

If the VB-to-FB conversion impacts any applications or processes, update references to the file to reflect the new format.

//STEP001      EXEC  PGM=SORT
//SYSOUT DD    SYSOUT=*
//SORTIN DD    DSN=FILE01,DISP=SHR
//FBOUT  DD    DSN=FILE02,DISP=(NEW,CATLG,DELETE),
//             UNIT=3390,SPACE=(CYL,(5,5))
//SYSIN  DD    *
  OPTION COPY
  OUTFIL FNAMES=FBOUT,VTOF,OUTREC=(5,100)
/* 

Up to 100 bytes of data starting at position 5 (after the RDW 4 bytes) of the VB input record appears in the FB output record starting at position 1. The FB output records are all 100 bytes long. By default, if a VB input record has less than 100 data bytes, DFSORT pads the output data with blanks on the right to 100 bytes. However, you can change the padding character to anything you like with OUTFIL’s VLFILL parameter. For example, VLFILL=C’*’ pads with asterisks and VLFILL=X’00’ pads with binary zeros:

//SYSIN  DD    *
  OPTION COPY
  OUTFIL FNAMES=FBOUT,VTOF,OUTREC=(5,100), VLFILL=C’ ’
/*  

VLFILL=f – Missing fields will be filled with blanks (x’40’) when CONVERT option in use; missing fields cause application termination when CONVERT is not specified .

Note: If VLFILL is specified, the OUTREC parameter must also be specified. VLFILL is ignored when the FTOV parameter is used.

The CONVERT parameter is used in conjunction with the OUTREC parameter to convert variable-length records to fixed-length records. The records do not require an RDW and will be written to the output file(s) with a RECFM of F or FB. When using CONVERT, you no longer need to apply the rules for “Specifying the FIELDS parameter for Variable-Length Records” found in the description of the OUTREC control statement. You cannot specify the variable portion of the input records (position without length) when using CONVERT. The OUTFIL VLFILL parameter can be used to specify a different fill byte for any missing fields (see above description).

Notes: If CONVERT is specified, the OUTREC parameter must also be specified. CONVERT cannot be used with the IFTRAIL, FTOV, or VTOF parameters.

//STEP001 EXEC PGM=SORT                                         
//SORTIN   DD DSN=FILE,DISP=SHR               <===== Variable input file
//SORTOUT  DD DSN=OUTPUT.FIXED.FILE,   <===== Fixed output.     
//          DISP=(NEW,CATLG,DELETE),                            
//          UNIT=(SYSDA),SPACE=(TRK,(50,15),RLSE),              
//          DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)                   
//SYSOUT   DD SYSOUT=*                                          
//SYSIN    DD *                                                 
  INREC FIELDS=(1:1,4,                                          
                6:6,74)                                         
  SORT FIELDS=(62,8,CH,A)                                       
  OUTFIL OUTREC=(1:1,4,                                         
                 6:6,74,                                        
                 80:C' '),CONVERT
//*

Converting from VB to FB format using the VTOF utility is a valuable capability in environments where fixed-length records are preferred or required. By following the outlined steps and considering best practices, organizations can seamlessly transition their data files to meet specific formatting needs while preserving data integrity and system compatibility. The VTOF utility serves as a reliable tool for efficiently performing this conversion and aligning data structures with the desired file format.

Read JCL blogs : Click Here SYNCSORT Manual : Click Here

Scroll to Top