>Do Leftbox > >Do abc > >Do xyz > >*Some Other Code > >PROCEDURE Leftbox >Locate For Left(Alltrim(PS),4)='1 w1' AND Right(Alltrim(PS),1)='k' >Replace PS With ; >STRTRAN(PS,Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-1), Alltrim(Str(Val(Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-1))-15))) ; >PS With ; >STRTRAN(PS,Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-4), Alltrim(Str(Val(Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-4))-4))) ; >PS With ; >STRTRAN(PS,Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-2), Alltrim(Str(Val(Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-2))+4))) >cNEWBOTTOMLINE=Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-1) >BOXSTARTCOLUMN=Val(Getwordnum(PS, Getwordcount(PS)-4)) >BOXENDCOLUMN=385 >BOXSTARTROW=Val(Getwordnum(PS, Getwordcount(PS)-3)) >BOXENDROW=BOXSTARTROW+Val(Getwordnum(PS, Getwordcount(PS)-1)) >BOXCOLUMNRANGE=385-m.BOXSTARTCOLUMN >RETURN >>
* Let us assume at this point that variable "MyVar" doesn't currently exist. ? VARTYPE(MyVar) * Above displays "U" since MyVar does not yet exist within this context DO Proc1 ? VARTYPE(MyVar) * Above displays "U" since MyVar does not exist in this context, when subprogram was called, it created (within its own context) the * variable and assigned it, then discarded it upon exit. MyVar = 1 && Variable MyVar is created and assigned a value ? VARTYPE(MyVar) * Above displays "N" DO Proc1 ? VARTYPE(MyVar) * Above will display "C" -- since the variable exists within the context of the caller of Proc1, the subprogram will assign the existing variable. PROCEDURE Proc1 MyVar = "Test" ENDPROCIt may be a good idea that variables to be assigned within a subprogram to be passed as parameters -- this would avoid any hidden "side effect".