Understanding Program Specialization in Simplified Mode

In the simplified mode of program specialization, you set the specialization variable to its value anywhere in the program except a data port. The value of the variable is "frozen in memory." The table below shows the result of using the simplified mode to specialize on the values CURYEAR = 1999, MONTH = 1, CURMONTH = 12,DAY1 = 4, and CURDAY = 7.

Source Program Specialized Program Comment
INP3.
DISPLAY "INPUT DAY".
ACCEPT DAY1.
MOVE YEAR TO tmp1.
PERFORM ISV.
IF DAY1 > tt of MONTHS
( MONTH ) OR DAY1 < 1
THEN
DISPLAY "WRONG DAY".
INP3.
DISPLAY "INPUT DAY".
MOVE YEAR TO tmp1.
PERFORM ISV.
IF 0004 > TT OF
MONTHS( MONTH ) THEN
DISPLAY "WRONG DAY"
END-IF.
ACCEPT removed.

No changes in these statements (YEAR is a "free" variable).

Value for DAY1 substituted. The 2nd condition for DAY1 is removed as always false. END-IF added.

MAINCALC.
IF YEAR > CURYEAR
THEN
MOVE YEAR TO
INT0001
MOVE CURYEAR TO
INT0002
MOVE 1 TO direction
ELSE
MOVE YEAR TO
INT0002
MOVE 2 TO direction
MOVE CURYEAR TO
INT0001.
MAINCALC.
IF YEAR > 1999
THEN
MOVE YEAR TO INT0001
MOVE 1999 TO
INT0002
MOVE 1 TO direction
ELSE
MOVE YEAR TO INT0002
MOVE 2 TO direction
MOVE 1999 TO
INT0001. 
Value for CURYEAR substituted.
MOVE int0001 TO
tmp3.
MOVE int0002 TO
tmp4.
IF YEAR NOT EQUAL
CURYEAR THEN
PERFORM YEARS.
MOVE int0002 TO tmp4.
IF YEAR NOT = 1999 THEN
PERFORM YEARS.
Component Maker removes the first line for tmp3, because this variable is never used again. Value for CURYEAR substituted.
IF MONTH > CURMONTH
THEN
MOVE MONTH TO
INT0001
MOVE CURMONTH TO
INT0002
MOVE 1 TO direction
  Value for MONTH substituted, making the condition (1>12) false, so Component Maker removes the IF branch and then the whole conditional statement as such.
ELSE
MOVE MONTH TO
INT0002
MOVE 2 TO direction
MOVE CURMONTH TO
INT0001.
MOVE 0001 TO
INT0002
MOVE 2 TO direction
MOVE 0012 TO
INT0001.
The three unconditional statements remain from the former ELSE branch. Value for CURMONTH substituted.
IF MONTH NOT EQUAL
CURMONTH THEN
PERFORM MONTHS.
PERFORM MONTHS.
The condition is true, so the statement is made unconditional.
IF DAY1 > CURDAY THEN
MOVE DAY1 TO
INT0001
MOVE CURDAY TO
INT0002
MOVE 1 TO direction
  This condition (4>7) is false, so Component Maker removes the IF branch and then the whole conditional statement as such.
ELSE
MOVE DAY1 TO
INT0002
MOVE 2 TO direction
MOVE CURDAY TO
INT0001.
MOVE 4 TO INT0002
MOVE 2 TO direction
MOVE 0007 TO
INT0001.
The three unconditional statements remain from the former ELSE branch. Values for DAY1 and CURDAY substituted.
IF day1 NOT EQUAL
CURDAY THEN
PERFORM DAYS.
PERFORM DAYS.
The condition is true, so the statement is made unconditional.