In the advanced mode of program specialization, you set the specialization variable to its value at a data port: any statement that allows the program to receive the variable's value from a keyboard, database, screen, or other input source. Subsequent operations can change the value, following the data and control flow of the program. The table below shows the result of using the advanced mode to specialize on the values MONTH = 1 and DAY1 = 4.
Source Program | Specialized Program | Comment |
---|---|---|
INP1. DISPLAY "INPUT YEAR (1600-2099)". ACCEPT YEAR. IF YEAR > 2099 OR YEAR < 1600 THEN DISPLAY "WRONG YEAR". |
INP1. DISPLAY "INPUT YEAR (1600-2099)". ACCEPT YEAR. IF YEAR > 2099 OR YEAR < 1600 THEN DISPLAY "WRONG YEAR". |
No changes in these statements (YEAR is a "free" variable). |
INP2. DISPLAY "INPUT MONTH". ACCEPT MONTH. IF MONTH > 12 OR MONTH < 1 THEN DISPLAY "WRONG MONTH". |
INP2. DISPLAY "INPUT MONTH". MOVE 0001 TO MONTH. |
ACCEPT is replaced by MOVE with the set value for MONTH.
With the set value, this IF statement can never be reached, so Component Maker removes it. |
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 0004 TO DAY1. MOVE YEAR TO tmp1. PERFORM ISV. IF 0004 > TT OF MONTHS( MONTH ) THEN DISPLAY "WRONG DAY" END-IF. |
ACCEPT is replaced by MOVE with the set value for DAY1.
No changes in these statements (YEAR is a "free" variable). The 2nd condition for DAY1 is removed as always false. END-IF added. |