Make sure that any program that will be run via the change to program statement does not initialize any global variables, since these initializations will be ignored. Even when control is transferred to a program that has been previously saved (with the save program as statement), the change to program statement transfers the value of its current global variables to the new program. The following code illustrates this situation:
global integer variable MaxCount is 10
response to ...
copy 20 to MaxCount
save program as Revised # MaxCount in Revised is 20
copy 30 to MaxCount
change to program Revised # MaxCount in Revised is 30
When global arrays are loaded from global memory into local memory for a new program, the new number of dimensions in the array is not checked against the old number. Therefore, if you execute a change to program for programs that contain global arrays, try to ensure that the array dimensions in all the programs are the same. If the new program array dimensions are larger than as defined in the original program, the last elements will contain default values for the constant or variable types; if the new program's array dimensions are smaller than as defined in the original program, the last elements will get dropped.