Topic
  • No replies
AltairAlexandre
AltairAlexandre
3 Posts

Pinned topic Level 77 - Cobol Enterprise

‏2013-07-01T17:00:58Z |

Hi all,

This is an old question, but even after researching a lot in Cobol Enterprise Documentation, I could not find an answer:

Is there any performance/memory usage gain in grouping all 77-levels at the top of working-storage in Cobol Enterprise?

Thanks!!

 

 

  • BillWoodger
    BillWoodger
    247 Posts

    Re: Level 77 - Cobol Enterprise

    ‏2013-07-01T17:23:41Z  

    Why bother with 77's at all? "These days" they are equivalent to a non-group 01-level.

    The "faster at the front of the program" idea probably comes from the time when the compiler assigned specific "cells" (of various types, FILE, WORKING-STORAGE, LINKAGE) to specific register usage. Enterprise COBOL doesn't do that.

    I'd not use 77s at all. Arrange the data how you feel it is best to assist with the understanding/maintenance of the program - which is how others at your site group things.

    Do you have a performance problem, or just curious?

     

  • AltairAlexandre
    AltairAlexandre
    3 Posts

    Re: Level 77 - Cobol Enterprise

    ‏2013-07-01T17:38:17Z  

    Thank you for the quick response.

    No performance problems at all, just curious, because the idea of "77 levels at the top"  was an advice of some of my first Cobol I / ANS instructors many years ago.

    by the way, talking about 01 levels for elementary items.... would you prefer to use example "1" or "2" below? Or they both work fine regarding performance/memory usage?

    1)

    01 FILLER.

        03  VAR-1    PIC X(02) VALUE SPACES.

        03   VAR-2   PIC X(03) VALUE SPACES.

     

    2)

    01 VAR-1 PIC X(02) VALUE SPACES.

    01 VAR-2 PIC X(03) VALUE SPACES.

     

     

    Thanks!

  • BillWoodger
    BillWoodger
    247 Posts

    Re: Level 77 - Cobol Enterprise

    ‏2013-07-02T06:15:11Z  

    Thank you for the quick response.

    No performance problems at all, just curious, because the idea of "77 levels at the top"  was an advice of some of my first Cobol I / ANS instructors many years ago.

    by the way, talking about 01 levels for elementary items.... would you prefer to use example "1" or "2" below? Or they both work fine regarding performance/memory usage?

    1)

    01 FILLER.

        03  VAR-1    PIC X(02) VALUE SPACES.

        03   VAR-2   PIC X(03) VALUE SPACES.

     

    2)

    01 VAR-1 PIC X(02) VALUE SPACES.

    01 VAR-2 PIC X(03) VALUE SPACES.

     

     

    Thanks!

    Number 1 will take eight bytes of storage, number 2, 16 bytes. I think, however, you'd have to have a very large number of fields before you'd get concerned about it.

    If you had 120,000 pieces of data defined that way, they'd occupy less than one percent of your available memory for WORKING-STORAGE (without using EXTERNAL). Yes, the other way would use less memory, but in a sort of "so what" type of way.

    To me, either is acceptable. Do whichever is done at your site, so you don't get someone wasting time thinking "why's it done like that? Maybe that's the problem?"

    What is unacceptable is calling things VAR-1 and VAR-2 :-)

    Very difficult to write ADD W-NUMBER-OF-APPLES TO W-SOFT-FRUIT-TOTAL.

    Very easy to write ADD VAR-1 TO W-VAR-9.

    Are they the same? Maybe, but with the second you need to understand fully the use of VAR-1 and VAR-9, before you can leave that line and look at the next.

    Write the type of code that you'd want to read if your worst colleague was changing the most complex program.

  • AltairAlexandre
    AltairAlexandre
    3 Posts

    Re: Level 77 - Cobol Enterprise

    ‏2013-07-02T12:25:49Z  

    Number 1 will take eight bytes of storage, number 2, 16 bytes. I think, however, you'd have to have a very large number of fields before you'd get concerned about it.

    If you had 120,000 pieces of data defined that way, they'd occupy less than one percent of your available memory for WORKING-STORAGE (without using EXTERNAL). Yes, the other way would use less memory, but in a sort of "so what" type of way.

    To me, either is acceptable. Do whichever is done at your site, so you don't get someone wasting time thinking "why's it done like that? Maybe that's the problem?"

    What is unacceptable is calling things VAR-1 and VAR-2 :-)

    Very difficult to write ADD W-NUMBER-OF-APPLES TO W-SOFT-FRUIT-TOTAL.

    Very easy to write ADD VAR-1 TO W-VAR-9.

    Are they the same? Maybe, but with the second you need to understand fully the use of VAR-1 and VAR-9, before you can leave that line and look at the next.

    Write the type of code that you'd want to read if your worst colleague was changing the most complex program.

    Thanks again for the great explanation!.

    Actually, I would never use those variable names in a real program, just typed them as a quick example for the question, and yes, I agree those variable names sound horrible.  :)