*replace.cmd 1/3/85
*this program replaces partial string in mid-field with new string

*calling program must place a string in 'oldpattern' variable
*and another string in 'newpattern' variable and have 'string'
*variable which could be a record field to search.  i.e. move
*field to 'string' and move patterns to the other two pattern variables


*make copy of string to work on
store string to newstring

&firstchar

*process newstring while old is anywhere in newstring
do while !(oldpattern) $ !($(newstring,cpointer)) .and. ;
   .not. &endstring

	*get start of old string
	store @(!(oldpattern),!($(newstring,cpointer)));
	  + cpointer - 1 to position

	*re-build newstring without oldpattern
	if position = 1
          store newpattern + $(newstring,len(oldpattern)+1) to newstring
else
	store $(newstring,1,position - 1) + newpattern + ;
          $(newstring,position + len(oldpattern)) to newstring

endif

*move cpointer past newpattern
store position + len(newpattern) to cpointer

enddo
/3/85
*this program replaces partial string in mid-field with new string

*calling program must place a string in 'oldpattern' variable
*and another string in 'newpattern' variable and have 'string'
*variable which could be a record field to search.  i.e. move
*field to 'string' and move patterns to the other two pattern variables


*make copy of string to work on
store string to newstring
release string
&firstchar

*process newstring while old is anywhere in newstring
do while 