S Correlative

Substitution. The S correlative replaces the contents of a referenced attribute (that is, the attribute referenced in line 2 of the Attribute Definition item) with the data in another attribute or with a string.

Format

S ; attribute# ; 'string '

Parameter(s)

attribute#

Number of the attribute whose data is to replace the contents of the attribute referenced in line 2 if its contents are not zero. To retain the original contents of the attribute referenced in line 2 if the attribute referenced by attribute# does not contain zero, use an asterisk (*) in place of the attribute# parameter.

string

Character string that is to replace the contents of the attribute referenced in line 2 if its contents are zero. The string must be enclosed in single quotes.

Using the S Correlative

Use the S code along with the F correlative to test for zero and then take different actions according to what kind of data it encounters. For example, F;1(S;*; 'NORMAL VALUE') specifies that if a value in Attribute 1 is zero, the string NORMAL VALUE is used; otherwise the original contents of Attribute 1 is to be used.

In the following example, the Attribute Definition item for the attribute PAYMENT in the OVERDUE.ORDERS file contains the correlative:

S ; 3 ; 'NONE'

The S correlative specifies that if the value in PAYMENT is zero, the word NONE is substituted. If the value in PAYMENT is not zero, then the data in the attribute CHECK-AMOUNT (Attribute 3) is substituted.

The S correlative thus makes it possible to bypass the original (out-of-date) data in the PAYMENT attribute.

See Also

Correlatives and Conversions Reference