Page 1 of 1

Using multiple 'FIND' commands in Edit Macro

PostPosted: Mon Apr 02, 2012 4:11 pm
by swetha489
Hi All,

I have a requirement where I have to find certain words in a COBOL program using an Edit Macro (I will be using both Rexx and Edit Macro commans in the same code). I have to first find the occurence of the PROCEDURE DIVISION and then the WORKING-STORAGE. I use the "FIND" command to accomplish this. It works fine when I am searching for the first term, however on searching for the second term, I get a RC(-4) although the second term (ie, WORKING-STORAGE) is present.

Please find below a snippet of the code. Both the FIND commands are issued in separate subroutines that are called consecutively.

SUBROUTINE1
    TERM = 'PROCEDURE'
    "FIND" TERM
    <do something>

SUBROUTINE2:
     WS = 'WORKING-STORAGE'
     "FIND" WS
      <do something>


I don't seem to understand what the problem is. It would be great if someone can help me out with this!

Re: Using multiple 'FIND' commands in Edit Macro

PostPosted: Mon Apr 02, 2012 4:15 pm
by enrico-sorichetti
what you posted is completely useless !

that' s just the <pseudocode> You will have to post the REAL code!

Re: Using multiple 'FIND' commands in Edit Macro

PostPosted: Mon Apr 02, 2012 4:30 pm
by GuyC
That would make sense, because once you are positioned on "Procedure division" you will get "bottom reached" when searching for "Working-storage".
Maybe you should locate back to the top , or do a "find first"

Re: Using multiple 'FIND' commands in Edit Macro

PostPosted: Mon Apr 02, 2012 4:47 pm
by swetha489
Thank you Guy!
"FIND FIRST" solved the issue!