BLOCK0

Use BLOCK0 to change the compiler default for QSAM files from unblocked to blocked (as if BLOCK CONTAINS 0 were specified) and thus gain the benefit of system-determined blocking for output files.

BLOCK0 option syntax

Read syntax diagramSkip visual syntax diagramNOBLOCK0BLOCK0

Default is: NOBLOCK0

Abbreviations are: None

Specifying BLOCK0 activates an implicit BLOCK CONTAINS 0 clause for each file in the program that meets the following three criteria:
  • The FILE-CONTROL paragraph either specifies ORGANIZATION SEQUENTIAL or omits the ORGANIZATION clause.
  • The FD entry does not specify RECORDING MODE U.
  • The FD entry does not specify a BLOCK CONTAINS clause.

Files for which the resulting BLOCK CONTAINS 0 clause is in effect have a blocking factor that is determined at run time from the data definition or from the data-set characteristics.

Interaction of the APPLY WRITE-ONLY clause and the AWO compiler option with BLOCK0:

  • If NOBLOCK0 is in effect, and the file description of a file that meets the three criteria listed above specifies APPLY WRITE-ONLY, the compiler issues an error message because APPLY WRITE-ONLY applies only to blocked files. But if BLOCK0 is in effect, the result is that the file is blocked, and the APPLY WRITE-ONLY clause is therefore accepted.
  • AWO applies to any QSAM files that have blocked variable-length records. If BLOCK0 is in effect, the result is that more files might be blocked than if NOBLOCK0 were in effect; thus AWO might apply to more files than it otherwise would.

Specifying BLOCK0 for existing programs might result in a change of behavior, and in some cases produce undesirable results for files opened as INPUT. For example:

  • The OPEN INPUT statement fails for files for which no block size can be determined.
  • Programs that continue after handling nonzero FILE STATUS codes for files opened as INPUT might abnormally terminate when executing subsequent I/O statements on those files.

For these reasons, after compiling with BLOCK0 you should investigate and test the effects on your program.

For recommendations about blocking, see the related reference from the Enterprise COBOL for z/OS® Migration Guide (in the information about migrating from CMPR2 to NOCMPR2).

Related references  
AWO  
APPLY WRITE-ONLY clause (Enterprise COBOL for z/OS Language Reference)  
BLOCK CONTAINS clause (Enterprise COBOL for z/OS Language Reference)  
Enterprise COBOL for z/OS Migration Guide  
(Recommendation for DCB= parameters of JCL)