Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

COBOL Programming :: RE: Replace function

$
0
0
Author: Robert Sample
Posted: Mon Sep 12, 2016 8:02 pm (GMT 5.5)

Use INSPECT and reference modification:
Code:
     INSPECT WS-SOURCE                           
         TALLYING WS-INIT-CHARS FOR CHARACTERS   
         BEFORE '" ONLY'.                         
                                                 
     MOVE WS-SOURCE TO WS-TARGET.                 
     MOVE WS-SOURCE (WS-INIT-CHARS + 3 : )       
       TO WS-TARGET (WS-INIT-CHARS + 2 : ).       

_________________
TANSTAAFL

The first rule of code reuse is that the code needs to be worth re-using.

"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." -- Donald Knuth


Viewing all articles
Browse latest Browse all 8500

Trending Articles