Writing a Short Format-FB Block with BSAM or BPAM

If you have fixed-blocked record format, you can set the length of a block when you are writing blocks to a sequential data set. You can change the block size field in the DCB (DCBBLKSI, without LBI) or in the DCBE (DCBEBLKSI, with LBI) to specify a block size that is less than what was originally specified for the data set. You should not, however, change that field to specify a block size that is greater than what was originally specified.

You change block size in the DCB or DCBE before issuing the WRITE macro. It must be a multiple of the LRECL parameter in the DCB. After this is done, any subsequent WRITE macros issued write records with the new block length until you change the block size again.

This technique works for all data sets supported by BSAM or BPAM. With extended-format sequential data sets, the system actually writes all blocks in the data set as the same size, and on a READ returns the full-size block but it returns the length specified on the WRITE for the block. Your program should not depend on the extra bytes that READ might return at the end of the data area.

Recommendation: You can create short blocks for PDSEs but their block boundaries are not saved when the data set is written to DASD. Therefore, if your program is dependent on short blocks, do not use a PDSE.

Related reading: See Processing PDSE Records for information about using short blocks with PDSEs.