Wednesday 19 August 2015

Converting FB file to VB file and vice versa using SORT

Converting Fixed Block file to Variable Block file
We can use FTOV to do this conversion
SORT Parameters:
SORT FIELDS=COPY
OUTFIL FNAMES=VBOUT,FTOV
VBOUT is the output file of variable length
If the input file is 80 bytes FB file, then VB file will be created with 84 bytes where 4 bytes if for RDW
VBOUT length should be extra 4 bytes for RDW(Record Descriptor Word)
The total length of the record in VB file is RDW (4 bytes) + actual record length
Converting Variable Block file to Fixed Block file
We can do it using VTOF in SORT
SORT parameters:
SORT FIELDS=COPY
OUTFIL FNAMES=FBOUT,VTOF,OUTREC=(5,76)
If VB file is 80 bytes, the FB file will be created with 76 bytes.
OUTREC is mentioned as the data is to be copied from 5th position where first 4 bytes is for RDW and doesn’t contain any data.
When the system stores VB file, it puts 4 bytes RDW (Record Descriptor Word) in front of each record where first 2 bytes is a binary half word of length S9(04) COMP which contains length of the record including RDW itself and other 2 bytes contain zeros.

No comments:

Post a Comment