What is the difference between FB and F and spanned records.

JES2/3, JCL, utilities.
Post Reply
Subhash Chander
Registered Member
Posts: 20
Joined: Sun Jul 21, 2013 4:56 am

What is the difference between FB and F and spanned records.

Post by Subhash Chander »

Hi,

I searched but I didn't get an answer to tell the differnce between FB/F as a COBOL programmer. When should we use which?

I looked at http://publibz.boulder.ibm.com/cgi-bin/ ... 0312141355" onclick="window.open(this.href);return false; but the confusion remains.

For that matter what is FBS, I mean what is the practical use of it? Do we really use this format in COBOL applciations? I've just seen using FB, not even F.

Thanks for any help on this.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: What is the difference between FB and F and spanned reco

Post by Robert Sample »

One way to look at it is that F and FB files are the same -- the only difference is that F files are restricted to one record per block, instead of multiple records per block for FB. From a COBOL standpoint, F versus FB is a non-issue; from the system standpoint, however, FB is VASTLY preferred over F. Using a 3390 disk drive, half-track blocking, you will get 349 80-byte records per block of 27920 bytes or 698 records per track. If you use F instead, you get 78 records per track -- a reduction of 620 records per track. This will impact how much space your data set requires.

FBS means to use standard blocks -- which means every block of the data set, except possibly the last, will be exactly the block size. The difference only comes into play when a data set is extended (DISP=MOD); with FB the new data will be written into another block (leaving possibly a short block in the data set each time the data set is extended) whereas with FBS the last block will be filled to the block size before a new block is written. Again, from a COBOL standpoint it makes no difference which you use but the system overhead will be less with FB versus FBS.

Note that VBS is completely different in meaning from VBS versus VB. VBS is variable blocked spanned and means the LRECL may be longer than the block size, and the system fills each block as full as possible.

The bottom line for a COBOL programmer is to ALWAYS use FB or VB for your data set, which if the data set is managed by SMS you won't have any control over that, anyway.
Quasar Chunawala
Registered Member
Posts: 34
Joined: Sun Aug 11, 2013 4:48 pm
Location: Pune

Re: What is the difference between FB and F and spanned reco

Post by Quasar Chunawala »

The crux of the concept is, on the mainframe data is transferred to/fro between the system and I/O devices in blocks.

Assume you had to buy 100 apples from the market place. If you buy just one apple every time, you'd have to make 100 trips. Transportation cost would be too high. Instead, if you bought in bunches of ten, you'd have to make just 10 trips. Also, carrying all of the 100 apples in just a single visit may be too heavy. So, there's a trade-off.

Think of the records in 1 block as apples in a bunch. You'd have to choose the optimum block-size(BLKSIZE) for you dataset.
Mr Awasthi
Registered Member
Posts: 26
Joined: Mon Aug 12, 2013 10:42 am

Re: What is the difference between FB and F and spanned reco

Post by Mr Awasthi »

These are excellent explanations. Thanks Robert and Quasar.
Subhash Chander
Registered Member
Posts: 20
Joined: Sun Jul 21, 2013 4:56 am

Re: What is the difference between FB and F and spanned reco

Post by Subhash Chander »

I had been keeping away from forums but this helps.
User avatar
ApexNC
Registered Member
Posts: 10
Joined: Sun Dec 08, 2013 7:03 pm
Contact:

Re: What is the difference between FB and F and spanned reco

Post by ApexNC »

Robert Sample wrote:... but the system overhead will be less with FB versus FBS.
Found this forum topic while googling info on FBS. An excellent, detailed answer except for this little bit. According to "DFSMS: Using Datasets"
http://publibz.boulder.ibm.com/cgi-bin/ ... A0/3.1.2.1 - "A sequential data set with standard format records (format-FS or -FBS) sometimes can be read more efficiently than a data set with format-F or -FB records. This efficiency is possible because the system is able to determine the address of each record to be read, because each track contains the same number of blocks."

FBS can give you less overhead, but at the risk of "losing" data if the file is ever written to with DISP=MOD.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: What is the difference between FB and F and spanned reco

Post by William Collins »

True, but COBOL can't make any use of that directly. C/C++, Assembler, can. It allows "seek" type access, "find me the 30,291st record on the file, please". With F/FB, that requires reading from the start of the file (due to possibility of short blocks) with FBS (and must not have short blocks, except the last, no DISP=MOD) the position can be calculated.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: What is the difference between FB and F and spanned reco

Post by Robert Sample »

ApexNC, the key word in your quote is "sometimes". The context of the original post was COBOL and hence the efficiency gain by direct addressing is not possible. Furthermore, the FBS system overhead I mentioned is that of determining if the last block is a short block and how many records will be added to complete the block -- none of which is necessary (or done) for FB.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: What is the difference between FB and F and spanned reco

Post by William Collins »

Actually, where I said F/FB, I doubt I was correct for F. There can hardly be a short-block there. Obviously there would be a different issue with using F, which would slow down the fast access anyway.
Subhash Chander
Registered Member
Posts: 20
Joined: Sun Jul 21, 2013 4:56 am

Re: What is the difference between FB and F and spanned reco

Post by Subhash Chander »

ApexNC wrote:
Robert Sample wrote:... but the system overhead will be less with FB versus FBS.
.
.
FBS can give you less overhead, but at the risk of "losing" data if the file is ever written to with DISP=MOD.
Sumbled upon on this topic again and I wonder what "overhaeads" we talk here, all the times?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: What is the difference between FB and F and spanned reco

Post by Robert Sample »

There is system CPU time involved in doing an I/O -- moving the data from the buffer in memory to the disk / tape device, determining where to write data when DISP=MOD is used, and blocking / deblocking data just for 3 examples (there is more done by the system but I'm not going to provide an exhaustive list).
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “JCL - Job Control Language.”