Menu

#54 COPY-REPLACING statement not interpreted

v1.0 (example)
closed-fixed
nobody
7
2015-03-06
2015-02-17
Inaki GE
No

Hi,
Besides the typical COPY statement "COPY copyfile." it exists the extended COPY statement "COPY copy_file REPLACING token BY new_token.". For more details, http://www.simotime.com/cpyrep01.htm

In my Cobol programs is very common to find it; see the following example:
"COPY SDH002F0 REPLACING == :L: == BY == SDH2F ==."
The name of the copy file is SDH002F0 and what the statement does is to replace the :L: token (I guess that "L" refers to Library) in variables by the name of the copy "SDH2F". The ":L:" structure only can appear in the replacing clause of the Copy statement in .cbl file, while in copy files it is widely accepted.

I have checked the .xml files generated by Koopa and it seems that it only knows to interpret the basic COPY statement and nothing more is done when finding the extended statement. The best solution would be to apply the token replacement directly in the variables of the copy file. If not possible, at least Koopa should displayed in the .xml file that a COPY-REPLACING statement has been found, with its clauses.

I am looking forward to your answer.
If you need further information or any example, do not hesitate to contact me.
Thanks for your support.
Regards.

Related

Discussion: Question re. COPY-REPLACING

Discussion

  • Inaki GE

    Inaki GE - 2015-03-02

    Hi again,
    I have checked that your latest update (r213) is related to COPY improvement.
    I wonder if in a short term you also plan to implement this COPY REPLACING issue. I am trying to parse some COBOL programs and I am encountering this error in Koopa that does not enable me to continue.

    I am looking forward to your answer.
    Thanks.
    Best regards.

     
  • KrisDS

    KrisDS - 2015-03-02

    I am definitely willing to take a look at it. I'm just not sure how soon that may be.

     
  • KrisDS

    KrisDS - 2015-03-05

    Can you please try out [r215] ? I tried it on your sample and it seems to accept it now.

    The support for REPLACING is incomplete (no LEADING, TRAILING, or literals), so you may still find problems. I don't have many useful samples to verify against myself.

     

    Related

    Commit: [r215]

  • Inaki GE

    Inaki GE - 2015-03-05

    Hi again,
    I have checked the latest version with 2 examples (r215) and it seems to work well when exporting the Cobol parsed file to XML. The only thing is that I do not see any output in the screen when executing Koopa directly from the GUI client and not from the command line (I do not usually use GUI client but to let you know...).

    Find attached the 2 example files so that you can also check it.

    When I execute Koopa for all my Cobol files I will let know if some issue appears.

    Thanks for your support.
    Best regards.

     
  • KrisDS

    KrisDS - 2015-03-05

    Thanks. Any feedback on this will be greatly appreciated.

    And the output in the GUI does show up, but only after quite a long time. But the source view was not made with preprocessing in mind, and it is probably going loopy because token positions are no longer sequential. I will take a look at that later.

     
  • Inaki GE

    Inaki GE - 2015-03-06

    Hi,

    I have tested the latest Koopa version (r217) and the issues with surrounding spaces in pseudo-text for COPY REPLACING statement have appeared again. If I remove spaces between "==" everything is fine but when finding spaces, parsing errors appear.

    I suppose that some change in r216 or r217 version has provoked this.

    Let me know.
    Thanks.

     

    Last edit: Inaki GE 2015-03-06
  • KrisDS

    KrisDS - 2015-03-06

    I pushed a small fix in [r218]. Seems to work on my end. Can you check ?

     

    Related

    Commit: [r218]

  • Inaki GE

    Inaki GE - 2015-03-06

    Hi again,

    Now it works well again with surrounding spaces.

    The only issue that remains after executing Koopa for all my cbl files are the GENERATE XML statement.

    Thanks for your support.
    Regards

     
  • KrisDS

    KrisDS - 2015-03-06

    All right. Good news.

    I'm going to close this specific issue. If anyone encounters problems with the REPLACING clause at a later time, please just create a new issue with more specifics. I'll extend the implementation as needed.

     
  • KrisDS

    KrisDS - 2015-03-06
    • status: open --> closed-fixed
     

Log in to post a comment.