FB and VB Modes

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

FB and VB Modes

Postby kandellisuresh » Fri Oct 01, 2010 1:34 am

What is difference between fixed and variable modes. In which senarios we will use these types?
Posts: 9
Joined: Thu Sep 02, 2010 9:29 am
Has thanked: 0 time
Been thanked: 0 time

Re: FB and VB Modes


Re: FB and VB Modes

Postby dick scherrer » Fri Oct 01, 2010 2:06 am


Fixed - records have the same lrecl.

Variable - records may contain multiple lrecls.

You use them as needed. . . If is best to not choose a solution and then try to find a requirement.

Until you become much more familiar with this technology, suggest you write only fixed length data and read variable length data if the file you are given as input is variable.
Hope this helps,
User avatar
dick scherrer
Global moderator
Posts: 6308
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 90 times

Re: FB and VB Modes

Postby steve-myers » Fri Oct 01, 2010 4:07 am

Just a couple of minor points to add to dick.scherrer.

In a fixed length data set all logical records have the same length. If the data set is FB these logical records are in a block that always contains a multiple of the logical record length.

In a variable length data set, each logical record can have a different length. The record length is stored in a prefix called a Record Descriptor Word (RDW). The data blocks can also vary in length. Like a logical record each data block stores its length in a prefix called a Block Descriptor Word (BDW).

I generally use VB data for print type data; this saves output space, most of the time, anyway, and you don't have to blank the rightmost part of a data line as is often the case with fixed length records, which usually speeds up your program. I've been doing this for almost 40 years, so it's second nature to me, but most people find fixed length records easier to handle than variable length records.

This manual, http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/dgt2d490/ is mainly intended for Assembler programmers, but the link points directly to good descriptions of BDWs and RDWs. z/OS usually fills in BDWs for you; even Assembler programmers rarely create them.
Global moderator
Posts: 1773
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 168 times

Return to IBM Cobol