Setting a Specialization Variable to Multiple Values

For Domain-Based Componentization, Component Maker lets you set the specialization variable to a range of values (between 1 and 10 inclusive, for example) or to multiple values (not only CHECK but CREDIT-CARD, for example). You can also set the variable to all values not in the range or set of possible values (every value but CHECK and CREDIT-CARD, for example).

Component Maker uses multiple values to predict conditional branches intelligently. In the following code fragment, for example, the second IF statement cannot be resolved with a single value, because of the two conflicting values of Z coming down from the different code paths of the first IF. With multiple values, however, Component Maker correctly resolves the second IF, because all the possible values of the variable at the point of the IF are known:

IF X EQUAL Y
  MOVE 1 TO Z
ELSE
  MOVE 2 TO Z
DISPLAY Z.
IF Z EQUAL 3
  DISPLAY "Z=3"
ELSE
  DISPLAY "Z<>3"

Keep in mind that only the following COBOL statements are interpreted with multiple values:

That is, if the input of such a statement is defined, then, after interpretation, its output can be defined as well.

Single-Value Example:

MOVE 1 TO Y.
MOVE 1 TO X.
ADD X TO Y.
DISPLAY Y.
IF Y EQUAL 2 THEN...

In this fragment of code, the value of Y in the IF statement (as well as in DISPLAY) is known, and so the THEN branch can be predicted.

Multiple-Value Example:

IF X EQUAL 0
  MOVE 1 TO Y
ELSE
  MOVE 2 TO Y.
ADD 1 TO Y.
IF Y = 10 THEN... ELSE...

In this case, Component Maker determines that Y in the second IF statement can equal only 2 or 3, so the statement can be resolved to the ELSE branch.

The statement interpretation capability is available only when you define the specialization variable "positively" (as equalling a range or set of values), not when you define the variable "negatively" (as not equalling a range or set of values).