Codes normally used as conversions can be included in a correlative code (line 8) to apply a conversion to the data, or to a portion of the data, part of the way through the application of the correlative.
For example, the decimal place in a number can be properly placed by the MR or ML code during arithmetic operations specified by the A or F correlative.
See Combining Correlatives and Conversions for additional information.
Two or more codes can be entered on the same line of an Attribute Definition item in one of two ways:
The codes can be separated with value marks (CTRL+]).
One code can be embedded within another code.
For example, multiple file translation correlatives make it possible to retrieve data from destination files that are at two or more removes from the source file. In the example below, the data for the attribute BAL.DUE in the ORDERS file can be obtained from the OVERDUE.ORDERS file by creating the following synonym for Attribute 3, CUST.ID, in the ORDERS file:
BAL.DUE 001 S 002 3 003 Balance Due 004 005 006 007 008 TCUSTOMERS ; X ; ; 12 ] TOVERDUE.ORDERS ; X ; ; 6 009 R 010 8 |
The two TFILE correlatives in the preceding example reference:
Attribute 12, BAL.DUE, of the CUSTOMERS file
Attribute 6, BAL.DUE, of the OVERDUE.ORDERS file
As illustrated below, the Attribute Definition item for Attribute 12, BAL.DUE, in the CUSTOMERS file, must itself contain a TFILE correlative that points to Attribute 6, BAL.DUE, in the OVERDUE.ORDERS file:
BAL.DUE 001 S 002 12 003 Balance Due 004 005 006 007 008 TOVERDUE.ORDERS ; X ; ; 6 009 R 010 8 |
This link enables the data in Attribute 6 of the OVERDUE.ORDERS file to be accessed from the ORDERS file via the two file translation correlatives (that is, through the CUSTOMERS file).
The next Attribute Definition item contains a TFILE correlative embedded in an F correlative:
TAX 001 S 002 0 003 Tax 004 005 006 007 008 F ; 1 ; (TBOOK-CATALOG ; X ; ; 3) ; 2 ; * ; C5 ; * ; S ; (MR22) 009 R 010 8 |
The embedded TFILE correlative is enclosed in a set of parentheses.
In the preceding example, the F correlative uses Attribute 1, BOOKCODE, in the ORDERS file to reference the item-IDs in the BOOK-CATALOG file. The TFILE correlative translates data from Attribute 3, PRICE, of the BOOK-CATALOG file. PRICE is then multiplied by the data in Attribute 2, QTY, of the ORDERS file, and the result is then multiplied by 5 to obtain the 5% sales tax. The S function sums the data in the MultiValued attribute TAX. Finally, a masked decimal conversion is applied to the result, which places the decimal point properly.
Applying an MR conversion at the end of a correlative is described in more detail in the Combining Correlatives and Conversions section.
See Also
Using Correlatives as Conversions and Vice Versa
Using Special Functions with A and F Codes
Applying Conversion Operations Before Correlative Operations