• qualifying names

    From Mayer Goldberg@mayer.goldberg@gmail.com to comp.lang.cobol on Sun Sep 30 11:13:11 2018
    From Newsgroup: comp.lang.cobol

    When should one qualify names in cobol: Every time, or when there's a conflict?

    Do you write

    first-name of very-long-name-of-some-structure

    or

    first-name

    ?

    Up to now, I tried to qualify names all the time, but this hurts readability, and anyway, the compiler will let me know if there's some conflict. What's a good practice?

    Thanks,

    Mayer
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Richard@riplin@azonic.co.nz to comp.lang.cobol on Sun Sep 30 11:54:44 2018
    From Newsgroup: comp.lang.cobol

    On Monday, October 1, 2018 at 7:13:12 AM UTC+13, Mayer Goldberg wrote:
    When should one qualify names in cobol: Every time, or when there's a conflict?

    Do you write

    first-name of very-long-name-of-some-structure

    or

    first-name

    ?

    Up to now, I tried to qualify names all the time, but this hurts readability, and anyway, the compiler will let me know if there's some conflict. What's a good practice?


    Only qualify if it is essential to do so.

    Otherwise it is just clutter.

    The only reason to have data names duplicated in different structures is to cater for MOVE CORRESPONDING and no one does that (in my experience) except in specific cases such as one-off file conversions.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From docdwarf@docdwarf@panix.com () to comp.lang.cobol on Sun Sep 30 23:37:49 2018
    From Newsgroup: comp.lang.cobol

    In article <a9b57dc9-64f0-401c-bbe7-0d6c91938b28@googlegroups.com>,
    Mayer Goldberg <mayer.goldberg@gmail.com> wrote:

    [snip]

    What's a good practice?

    The one that gets your code through Prod Review.

    DD
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kerry Liles@kerry.liles@gmail.com to comp.lang.cobol on Mon Oct 1 10:19:43 2018
    From Newsgroup: comp.lang.cobol

    On 9/30/2018 2:13 PM, Mayer Goldberg wrote:
    When should one qualify names in cobol: Every time, or when there's a conflict?

    Do you write

    first-name of very-long-name-of-some-structure

    or

    first-name

    ?

    Up to now, I tried to qualify names all the time, but this hurts readability, and anyway, the compiler will let me know if there's some conflict. What's a good practice?

    Thanks,

    Mayer


    I would recommend only using qualification if required by the compiler
    (in other words for data names that appear with the same name in more
    than one structure). As another reply indicated, this is often
    encountered to support MOVE CORRESPONDING - another one of those COBOL constructs invented only to cause arguments among practitioners... :)

    --- Synchronet 3.20a-Linux NewsLink 1.114