Correlatives process data that is stored in file items to derive new data. This derived data is not stored in a file item but is newly derived each time the correlative is applied at run time.
For example, a personnel file might store the number of hours each employee works in one attribute, and each employee’s hourly rate in another attribute. Hours worked and hourly rate is data held by the system as raw data. Employees’ pay, however, need not be stored in the database. Instead, an arithmetic correlative can be used to derive the amount of each employee’s pay by multiplying hours worked by the hourly rate. The product of the multiplication is not stored as data in the file but is newly calculated each time the data is processed. This derived data can either be output in a report or be used for further processing.
Stored Data |
Processed Data |
|
Rate |
Hours |
Pay (Rate*Hours) |
$7.80 |
34.75 |
$271.05 |
$9.45 |
34.00 |
$321.30 |
$7.60 |
34.75 |
$264.10 |
$6.65 |
41.75 |
277.64 |
$8.10 |
36.25 |
293.63 |
If the data derived by this correlative were output in a report, it would look like this:
>LIST PERSONNEL RATE HOURS PAY HDR-SUPP ID-SUPP |
||
Rate. |
Hours |
Pay....... |
|
|
|
$7.80 |
34.75 |
$271.05 |
$9.45 |
34.00 |
$321.30 |
$7.60 |
34.75 |
$264.10 |
$6.65 |
41.75 |
$277.64 |
$8.10 |
36.25 |
$293.63 |
$5.95 |
40.00 |
$238.00 |
$8.95 |
42.00 |
$375.90 |
$7.90 |
38.50 |
$304.15 |
$8.30 |
38.75 |
$321.63 |
$8.25 |
39.00 |
$321.75 |
$7.50 |
35.50 |
$266.25 |
$8.45 |
41.00 |
$346.45 |
PAY is derived by a correlative from the two attributes RATE and HOURS. Arithmetic correlatives such as the one described above can be used to perform many mathematical and relational operations on raw data. See Performing Arithmetic Operations for further description of arithmetic correlatives.
Other correlatives can be used to take data from two different attributes and concatenate them together. For example, in a personnel or customer database, last names might be stored in Attribute 1 and first names in Attribute 2. Full names can be derived by a correlative that concatenates them together, with the last name either first or last.
If the data derived by this correlative were output in a report, it would look like this:
>LIST CUSTOMERS LAST-NAME FIRST-NAME FULL-NAME NAME HDR-SUPP ID-SUPP |
|||
|
|
|
|
Last Name. |
First Name. |
Full Name......... |
Name.............. |
|
|
|
|
JENKINS |
HAROLD |
JENKINS, HAROLD |
HAROLD JENKINS |
BOHANNON |
JOHN |
BOHANNON, JOHN |
JOHN BOHANNON |
BROWN |
JAMES |
BROWN, JAMES |
JAMES BROWN |
BUCKLER |
JULIE |
BUCKLER, JULIE |
JULIE BUCKLER |
LEARY |
BILL |
LEARY, BILL |
BILL LEARY |
MASON |
JULIA |
MASON, JULIA |
JULIA MASON |
ORLANDO |
AMY |
ORLANDO, AMY |
AMY ORLANDO |
PIRS |
SANDRA |
PIRS, SANDRA |
SANDRA PIRS |
ASH |
MARY |
ASH, MARY |
MARY ASH |
EDWARDS |
ANTHONY |
EDWARDS, ANTHONY |
ANTHONY EDWARDS |
PEERCE |
JAN |
PEERCE, JAN |
JAN PEERCE |
PIERCE |
RICK |
PIERCE, RICK |
RICK PIERCE |
JOHNSON |
ANNE |
JOHNSON, ANNE |
ANNE JOHNSON |
JOHNSON |
HENRY |
JOHNSON, HENRY |
HENRY JOHNSON |
HIGGINS |
HENRY |
HIGGINS, HENRY |
HENRY HIGGINS |
EDGECOMB |
DAVID |
EDGECOMB, DAVID |
DAVID EDGECOMB |
MEADE |
ANDREW |
MEADE, ANDREW |
ANDREW MEADE |
Data in FULL-NAME and NAME is derived from the attributes LAST-NAME and FIRST-NAME. The stored data is listed first (LAST-NAME, FIRST-NAME), then the concatenated full name in the same order (FULL-NAME) and in reverse order (NAME).
See C Code for a full description of the correlative that performs this function.
Yet other correlatives can be used to extract specified portions of data from an attribute. To reverse the preceding example, if people’s full names are stored in one attribute in the order first-name last-name, a correlative can extract just the last names. Or both the last and the first names can be extracted separately, then listed in the order last-name first-name.
If the data derived by this correlative were output in a report, it would look like this:
>SORT CUSTOMERS BY LAST-NAME NAME LAST-NAME FULL-NAME HDR-SUPP ID-SUPP |
||
|
|
|
Name.............. |
Last Name. |
Full Name......... |
|
|
|
MARY ASH |
ASH |
ASH, MARY |
JOHN BOHANNON |
BOHANNON |
BOHANNON, JOHN |
JAMES BROWN |
BROWN |
BROWN, JAMES |
JULIE BUCKLER |
BUCKLER |
BUCKLER, JULIE |
DAVID EDGECOMB |
EDGECOMB |
EDGECOMB, DAVID |
ANTHONY EDWARDS |
EDWARDS |
EDWARDS, ANTHONY |
HENRY HIGGINS |
HIGGINS |
HIGGINS, HENRY |
HAROLD JENKINS |
JENKINS |
JENKINS, HAROLD |
ANNE JOHNSON |
JOHNSON |
JOHNSON, ANNE |
HENRY JOHNSON |
JOHNSON |
JOHNSON, HENRY |
BOB LAMPSON |
LAMPSON |
LAMPSON, BOB |
BILL LEARY |
LEARY |
LEARY, BILL |
The correlatives that perform these operations extract the desired data from the attribute in which it is stored. Data in LAST-NAME and FULL-NAME is derived from the attribute NAME. See Extracting Data for a full description of the correlatives that perform these operations.
Correlatives can also be used to verify or test data, ensuring that only data specified by the correlative be selected, processed, or listed in a report. For example, there are correlatives that test whether data is of a certain length, or whether data falls within a specified range, or whether data matches a specified pattern. See Testing Data for a full description of the correlative which performs these functions.
Finally, there is a very powerful code, TFILE, that makes it possible to access data stored in other files and use it for processing and output. In effect, related data stored in different files can be linked together, allowing you to use data stored in multiple files to produce complex INFO/ACCESS reports. See TFILE Code for a full description of these operations. The TFILE code makes it possible to access data in another file. This powerful code eliminates the need for duplicating data in related files by retrieving data from one file for use in another file.
See Also