Conversions

Conversions change the format of either stored or derived data, converting it to an external format suitable for listing in INFO/ACCESS reports. For instance, the derived amount of an employee’s pay as calculated by the arithmetic correlative described in the preceding section would be unformatted data:

9673279

A conversion code can be applied to this number so that when it is output in a report, it is formatted as a dollar amount rounded off to two decimal places, complete with a dollar sign:

$967.33

Other conversion codes allow you to output times and dates in a number of different formats. For example, date conversions allow you to specify such formats as 19 JUL 1991, 07/19/91, 07-19-1991; time conversions let you specify formats such as 13:30, 01:30PM, or 01:30:00.

Still other conversion codes can be used to change lowercase characters to uppercase and vice versa, to translate decimal numbers and ASCII character strings to their hexadecimal equivalents (and vice versa), and to extract certain categories of characters for output, such as all alphabetic or all numeric characters, from stored data that includes both categories.

Conversions are used not only to convert stored and derived data into external format; they are also used to convert literals in an INFO/ACCESS query from external format into internal, or stored, format. For instance, if you typed the next query, a conversion code in the Attribute Definition item DATE would convert 11/14/89 into the system’s internal date format (in this case, 7989):

>SORT ACCOUNTS WITH DATE <= "11/14/89"

Conversion codes accomplish several purposes. Since conversions format data only when it is output, data can be stored without accompanying formatting characters such as dollar signs, commas, and decimal points, thus taking up less disk drive space. Operations such as sorting and comparing take less time when they are performed on unformatted data. The external format of large amounts of data can be changed easily by editing just one conversion code in the appropriate Attribute Definition item; changes need not be made to each piece of stored data.

Formatting Data for full descriptions of conversion codes.

See Also

Introduction to Correlatives and Conversions

Correlatives

How INFO/ACCESS Applies Correlatives and Conversions