Replace is most common in the production environment. There are many occasions we need to do data manipulation in the application programs.
In Cobol:
SOURCE-STRING: ‘HARE KRISH NARADA’
INSPECT SOURCE-STRING REPLACING ALL ‘H’ BY ‘#’
Result: ‘#ARE KRIS# NARADA’, similarly you can do for REPLACING BEFORE and REPLACING AFTER.
In SQL:
SELECT REPLACE(‘222A55′,’2′,’3’) FROM SYSIBM.SYSDUMMY1
RESULT: ‘333A55’
SOURCE: Tech
see some more examples:
| replace(‘123123tech’, ‘123’); | would return ‘tech’ |
| replace(‘123tech123’, ‘123’); | would return ‘tech’ |
| replace(‘222tech’, ‘2’, ‘3’); | would return ‘333tech’ |
| replace(‘0000123’, ‘0’); | would return ‘123’ |
| replace(‘0000123’, ‘0’, ‘ ‘); | would return ‘ 123’ |





