DocBag

Back Issue

Processing Non-standard Datasets(continued)

See Last Month's Issue for more information.

Variable Length Records

For variable length records, each block is prefixed with four bytes of block length information; each record is prefixed with four bytes of record length information. There are two flavours of variable length records - unspanned and spanned records.

If records are not spanned, then each record must fit in a block. Because of the block length information, the record length must be at least 4 less than the block length.

With spanned records, records can be segmented and so spread over more than one block. This allows the record length to be bigger than the blocksize. The length field in a record contains a segment length and segment control information.

The four bytes of record length information are included in the length of each variable length record. The first two bytes actually contain the record or segment length. The rightmost two bits of the third byte contain segment control information. If the these bits are zero for all records, then the file contains no spanned records.

Note that since zero in the segment control information indicates a complete record, you can specify RECFM=VBS for a VB dataset if you are in doubt. The LRECL value represents the largest record length - you can specify a larger value if you are not sure about the correct value initially.

One possiblity for analyzing record lengths for variable length data is to use the SORT utility. The following JCL:

//S1 EXEC SORT,REGION=6M //SORTIN DD DISP=SHR,DSN=CARS.PUBREAD.DAILY.SMF //SORTOUT DD DISP=(,PASS),UNIT=WORK,DSN=&&LENGTH,SPACE=(CYL,(1,1)) //SYSIN DD * SORT FIELDS=(1,2,FI,A) SUM FIELDS=NONE OUTREC FIELDS=(1,4,1,2) //S2 EXEC PGM=IDCAMS //IN1 DD DISP=(OLD,DELETE),DSN=&&LENGTH //SYSPRINT DD SYSOUT=* //SYSIN DD * PRINT INFILE(IN1) // will produce a report of unique length values found from lowest to highest.

Feedback

Comments or suggestions can be sent to the author.

Last Month's Topic

Big Iron