z/OS DFSMS Using Data Sets
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Spanned Records

z/OS DFSMS Using Data Sets
SC23-6855-00

Sometimes a record is larger than the control interval size used for a particular data set. In VSAM, you do not need to break apart or reformat such records, because you can specify spanned records when defining a data set. The SPANNED parameter permits a record to extend across or span control interval boundaries.

Spanned records might reduce the amount of DASD space required for a data set when data records vary significantly in length, or when the average record length is larger compared to the CI size. The following figures show the use of spanned records for more efficient use of space.

In Figure 1, each control interval is 10 240 bytes long.

Figure 1. Data set with nonspanned records

Data set with nonspanned records

In Figure 1 control interval 1 contains a 2000-byte record. Control interval 2 contains a 10 000-byte record. Control interval 3 contains a 2000-byte record. All together, these three records use 30 720 bytes of storage.

Figure 2 contains a data set with the same space requirements as in Figure 1, but one that permits spanned records.

Figure 2. Data set with spanned records

Data set with spanned records

The control interval size is reduced to 4096 bytes. When the record to be stored is larger than the control interval size, the record is spanned between control intervals. In Figure 2, control interval 1 contains a 2000-byte record. Control intervals 2, 3, and 4 together contain one 10 000-byte record. Control interval 5 contains a 2000-byte record. By changing control interval size and permitting spanned records, you can store the three records in 20 480 bytes, reducing the amount of storage needed by 10 240 bytes.

Remember the following rules:
  • A spanned record always begins on a control interval boundary and fills more than one control interval within a single control area.
  • For compressed data sets with spanned records, the length of the record prefix is 5 bytes. Because of the additional 5 bytes, the key offset plus the key length (that is, relative key position) must be less than or equal to the CI size less 15.
  • For key-sequenced data sets, the entire key field of a spanned record must be in the first control interval.
  • The control interval containing the last segment of a spanned record might also contain unused space. Use the unused space only to extend the spanned record; it cannot contain all or part of any other record.
  • Spanned records can only be used with key-sequenced data sets and entry-sequenced data sets.
  • To span control intervals, you must specify the SPANNED parameter when you define your data set. VSAM decides whether a record is spanned or nonspanned, depending on the control interval length and the record length. Spanned/nonspanned can also be specified in the data class.
  • Locate mode (OPTCD=LOC on the RPL) is not a valid processing mode for spanned records. A nonzero return code will be issued if locate mode is used.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014