Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Programming Guide

Defining and using regional data sets

Defining files for a regional data set
Specifying ENVIRONMENT options
REGIONAL option
Using keys with REGIONAL data sets
Using REGIONAL(1) data sets
Dummy Records
Creating a REGIONAL(1) data set
Example
Accessing and updating a REGIONAL(1) data set
Sequential access
Direct access
Example
Essential information for creating and accessing regional data sets

This chapter covers regional data set organization, data transmission statements, and ENVIRONMENT options that define regional data sets. How to create and access regional data sets for each type of regional organization is then discussed.

A data set with regional organization is divided into regions, each of which is identified by a region number, and each of which can contain one record or more than one record, depending on the type of regional organization. The regions are numbered in succession, beginning with zero, and a record can be accessed by specifying its region number, and perhaps a key, in a data transmission statement.

Regional data sets are confined to direct access devices.

Regional organization of a data set allows you to control the physical placement of records in the data set, and to optimize the access time for a particular application. Such optimization is not available with consecutive or indexed organization, in which successive records are written either in strict physical sequence or in logical sequence depending on ascending key values; neither of these methods takes full advantage of the characteristics of direct access storage devices.

You can create a regional data set in a manner similar to a consecutive or indexed data set, presenting records in the order of ascending region numbers; alternatively, you can use direct access, in which you present records in random sequence and insert them directly into preformatted regions. Once you create a regional data set, you can access it by using a file with the attributes SEQUENTIAL or DIRECT as well as INPUT or UPDATE. You do not need to specify either a region number or a key if the data set is associated with a SEQUENTIAL INPUT or SEQUENTIAL UPDATE file. When the file has the DIRECT attribute, you can retrieve, add, delete, and replace records at random.

Records within a regional data set are either actual records containing valid data or dummy records.

The major advantage of regional organization over other types of data set organization is that it allows you to control the relative placement of records; by judicious programming, you can optimize record access in terms of device capabilities and the requirements of particular applications.

Direct access of regional data sets is quicker than that of indexed data sets, but regional data sets have the disadvantage that sequential processing can present records in random sequence; the order of sequential retrieval is not necessarily that in which the records were presented, nor need it be related to the relative key values.

Table 21 lists the data transmission statements and options that you can use to create and access a regional data set.

Table 21. Statements and options allowed for creating and accessing regional data sets
File
declaration1
Valid statements,2 with
options you must include
Other options you
can also include
SEQUENTIAL OUTPUT
WRITE FILE(file-reference)
FROM(reference)
KEYFROM(expression);
 
LOCATE based-variable
FROM(file-reference)
KEYFROM(expression);
 
 
 
 
SET(pointer-reference)
SEQUENTIAL INPUT
READ FILE(file-reference)
INTO(reference);
 
READ FILE(file-reference)
SET(pointer-reference);
 
READ FILE(file-reference)
IGNORE(expression);
KEYTO(reference)
 
 
KEYTO(reference)
SEQUENTIAL UPDATE3
READ FILE(file-reference)
INTO(reference);
 
READ FILE(file-reference)
SET(pointer-reference);
 
READ FILE(file-reference)
IGNORE(expression);
 
REWRITE FILE(file-reference);
KEYTO(reference)
 
 
KEYTO(reference)
 
 
 
 
 
FROM(reference)
DIRECT OUTPUT
WRITE FILE(file-reference)
FROM(reference)
KEYFROM(expression);
 
DIRECT INPUT
READ FILE(file-reference)
INTO(reference)
KEY(expression);
 
DIRECT UPDATE
READ FILE(file-reference)
INTO(reference)
KEY(expression);
 
REWRITE FILE(file-reference)
FROM(reference)
KEY(expression);
 
WRITE FILE(file-reference)
FROM(reference)
KEYFROM(expression);
 
DELETE FILE(file-reference)
KEY(expression);
 
Notes:
  1. The complete file declaration would include the attributes FILE, RECORD, and ENVIRONMENT; if you use any of the options KEY, KEYFROM, or KEYTO, you must also include the attribute KEYED.
  2. The statement READ FILE(file-reference); is equivalent to the statement READ FILE(file-reference) IGNORE(1);
  3. The file must not have the UPDATE attribute when creating new data sets.

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)