Thursday, December 8, 2011

JCL: How to fix B37 AbEnd


 The most common reason of a B37 AbEnd is a situation when operating system can't allocate secondary extent for DASD output data set because there is not enough space on the DASD unit[s], defined for the data set allocation.
Sequential data set can be allocated in up to 16 extents (normally one primary and up to 15 secondary).  When Operating System can't find space for primary allocation, job gets cancelled with JCL error before attempting to execute it.  If primary allocation request is satisfied, job starts running, allocating secondary extents when (and if) necessary.  If an attempt to allocate secondary extent fails, job AbEnds with B37.
There is a popular belief that increasing primary space solves B37 AbEnd problem.  Indeed, it might work for some situations, but it might fail to work for other (those with significant deviations in the size of the data set).  B37 AbEnd is caused by the failure of secondary space allocation and this is what should be addressed when fixing a B37 problem.
The right solution is to specify more than one (default) UNIT for the output data set, E.g.:  UNIT=(SYSALLDA,3).  Thus, when system can't find secondary extent on the first volume (i.e. volume where primary extent is allocated), it switches to the second volume, etc.  Normally specifying 2 or 3 UNITs will work, but it might make sense to specify more, depending on the number of generally available DASD units and predicted deviations in the data set size.
Provided that there are enough DASD units for secondary space allocation, it is important also to maintain some sort of a reasonable balance between primary and secondary space requests.  While there are no universal rules for determining what balance is "right", there is "rule of a thumb" that works reasonably well in most cases.
      • Evaluate the "peak" volume of the output data set (CYLs or TRKs).  One good way is to look at input file processing of which caused B37 AbEnd and make approximate adjustments based on the ratio of output/input record lengths.  Let it be 100 CYLs, for example.
      • Use 50% of the "peak" volume as primary space and 10% of the peak volume as secondary space.  This will give the following space allocation for 100 CYL "peak" volume example:  SPACE=(CYL,(50,10),RLSE).  Request to ReLeaSE unused space when the output data set gets closed is a good practice improving the overall system performance.
      • As can be easily seen, this allocation balance, while requesting only 50% of "peak" volume upfront in primary space request, permits to increase data set size up to 200% of the "peak" volume (50%+15*10%=50%+150%=200%).  Provided, of course, that the sufficient number of DASD units was defined.  For most practical situations (a typical one is space request for sort work files) this will be a reasonable balance between primary and secondary space.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.