the length of the current record): this value is inserted automatically, and requires nO action by the
Chapter 11: Stream-oriented Transmission 149
programmer.
In addition, four extra control bytes are placed at the beginning of the block
(that is, the record). These bytes contain the block size;
the value is inserted in the same way as the record length.
VB-format: The records are blocked. Each record consists of:
Four control bytes Data bytes
The four control bytes have the same purpose as in V-format records. The block has four extra control bytes for the block size in the same way as V-format records.
0- and DB-format: see "ASCII Data Sets".
Undefined-length Records
All processing is the responsibility of the programmer. If a length specification is required in the record, the programmer must provide one and also interpret it.
RECSIZE option
The RECSIZE option specifies the record length. This is the sum of:
1. The length required for data. For variable-length and undefined records, this is the maximum length.
2. Any control bytes required. Variable-length records require four, for the record length; fixed-length and undefined-length records do not require any.
The record length can be specified as a decimal integer constant, or as a variable with the attributes FIXED BINARY(31,0) STATIC.
The value is subject to the following conventions:
Maximum: Fixed-length, and
undefined-length (except ASCII data sets): 32,760 bytes.
Variable-length (except ASCII data sets): 32,756 bytes ASCII data sets: 9999 bytes
150 OS PL/I CKT AND OPT LRM PART I
Zero value: A search for a valid value is made in (in the following order) :
DO statement for the data set associated with the file
Data set label If neither of these can provide a value, default action is taken (see "Record Format Defaults·, later in this section).
Negative value: The UNDEFINEDFILE condition is raised.
A value implied by the LINESIZE option overrides a value specified in the RECSIZE option.
BLKSIZE Option
The BLKSIZE option specifies the block size. This is the sum of:
1. The lengths of all the records in the block. For variable length records, the length of each record includes the four control bytes for the record length.
2. Any control bytes required. Variable-length blocked records require four for the blocksize; fixed-length and undefined-length records do not require any.
Any block prefix bytes (ASCII data sets)
The block size can be specified as a decimal integer constant, or as a variable with the attributes FIXED BINARY(31,0) STATIC.
The value is subject to the following conventions:
Maximum: 32,760 bytes (or 9999 for an ASCII data set for which BOFOFF is specified without a prefix-length value)
Zero value: A search for a valid value is made in (in the fOllowing order):
DO statement for the data set associated with the file
Data set label If neither of these can provide a value, default action is taken (see "Record Format Defaults·, later in this section).
Negative value: the UNDEFINEDFILE condition is raised.
The relationship of the block size to the record length depends on the record format:
FB-format or FBS-format: The block size must be a multiple of record length
VB-format: The block size must be equal to or greater than the sum of:
The lengths of all the records in the block
Four control bytes for the block size
DB-format: The blocksize must be equal to or greater than the sum of:
Note:
The lengths of all the records in the block
Length of the block prefix (if block is prefixed)
1. The BLKSIZE option can be used with unblocked (F-,V-, or D-format) records as follows:
a. The BLKSIZE option, but not the RECSIZE option, is specified. The record length is set equal to the block size (minus any control or prefix bytes) and the record format is unchanged.
b. Both the BLKSIZE and the RECSIZE options are specified, and the relationship of the two values is compatible with blocking for the record format used. The records are assumed to be blocked and the record format is set to FB, VB, or DB whichever is appropriate.
2. If, for FB-format or FBS-format
records, the block Size equals the record length, the records are assumed to be unblocked and the record format is set to F.
Record Format Defaults
If any of the record format options is not specified in the ENVIRONMENT attribute, or in the associated DD statement or data set label, the following action is taken:
INPUT files:
Record format: The UNDEFINEDFILE condition is raised, except for files
associated with dummy data sets or the foreground terminal, in which case U-format is assumed.
Block size or record length: If one of these is specified, a search is made for the other in the
associated DD statement or data set label. If the search provides a value, the UNDEFINEDFILE
condition is raised if this value is imcompatible with the value in the specified option. If the search is unsuccessful, a value is derived from the value for the specified option (with the addition or subtraction of any control or prefix bytes).
If neither is specified, the
UNDEFINEDFILE condition is raised, except for files associated with dummy data sets, in which case a block size of 121 is assumed for F-format or U-format records and 129 for V-format records. For files associated with the
foreground terminal a record size of 120 is assumed.
OUTPUT files:
Record format: Set to VB-format, or if ASCII option specified, to DB-format
Record length: The specified or default LINESIZE value is used:
PRINT files:
F, FB, FBS, or U: LINESIZE + 1 V, VB, D, or DB: LINESIZE + 5 Non-PRINT files:
F, FB, FBS, or U: LINESIZE V, VB, D, or DB: LINESIZE + 4
Chapter 11: Stream-oriented Transmission 151
Block size: F, FB, or FBS: record length V or VB: record length + q
D or DB: record length + block prefix (see note 3)
BUFFER offset: F, FB, or U: 0
D,
or DB: qNote:
1. The standard default for LINESIZE is 120.
2. If the default block size as calculated above is greater than 32,760 the block size is set equal to
(record length + q), and the records are set to V-format, except when the ASCII option is specified. With ASCII data sets, if the default blocksize is greater than 32,760, or 9999 if BUFOFF is specified without a prefix-length value, then the block size is set equal to (record length + length of block prefix) and the record format is set to D.
3. with DB-format records on output files, the length of the block prefix
(that is, the buffer offset) must always be either 0 or q.
q. The optimizing and checkout compilers will also accept the form of record format specification used for the PL/I(F) compiler. In this form, the record length and block size are included in the format specification.
BUFFER ALLOCATION
A buffer is a main storage area that is used for the intermediate storage of data transmitted to and from a data set. The use of buffers allows transmission and computing time to be overlapped. Buffers are essential for the automatic blocking and deblocking of records.
BUFFERS option
The option BUFFERS(n) in the ENVIRONMENT attribute specifies the number(n) of buffers to be allocated for a data set;
this number must not exceed 255 (or such other maximum as was established at system generation). If the number of buffers is not specified or is specified as zero, two buffers are assumed for the optimizing compiler, and one buffer is assumed for the checkout compiler.
152 OS PL/I CKT AND OPT LRM PART I
The number of buffers can be specified in the BUFNO subparameter of a DD statement instead of in the ENVIRONMENT attribute.
DCB Subparameter
Some of the information that can be
specified in the options of the ENVIRONMENT attribute can also be specified in the DCB sUbparameter of a DO statement. The table gives a list of equivalents.
ENV Option Record format RECSIZE
BLKSIZE BUFFERS ASCII BUFOFF
DATA SET ORGANIZATION
DCB Subparameter RECFM
LRECL BLKSIZE BUFNO ASCII BUFOFF
The organization of a data set determines how data is recorded in the data set, and how the data is subsequently retrieved so that i t can be transmitted to the program.
This implementation recognizes four data set organizations, CONSECUTIVE, INDEXED, IREGIONAL, and VSAM. A data set that is to
be accessed by stream-oriented transmission must have CONSECUTIVE organization; since this is the default for data set
organization, i t need not be specified at all for a STREAM file.
CONSECUTIVE Data Sets
The records in a CONSECUTIVE data set are arranged sequentially in the order in which they were written; they can be retrieved only in the same order. After the data set has been created, the associated file can be opened for input (to read the data), or for output (to extend the data set by adding records at the end, or to replace the contents of the data set by new data:
the effect of using an OUTPUT file to . process an existing data set depends on the DISP parameter of the associated DO
statement) •