#23 Suppress when spaces

0.20
open
nobody
None
1
2014-06-18
2013-01-22
Luke Smith
No

Please add SUPPRESS WHEN SPACES to the ALTERNATE RECORD KEY IS ... clause.

 ALTERNATE RECORD KEY IS ... 
     SUPPRESS WHEN [ SPACES  ]
                   [ ZEROS   ]
                   [ ALL "single character literal" ]

This would improve performance for those that use alternate keys. Suppress when ZEROS or ALL literal would be nice to have (another vendor has them). Suppress when SPACES is mandatory in my book.

Discussion

  • Luke Smith
    Luke Smith
    2013-01-31

    Early RM-Cobol (back when it was re-packaged as TI-990 Cobol) always suppressed alternate keys when spaces. There was no way to write out an alternate key when it was spaces. This feature is needed to accommodate early RM-Cobol programs.

     
  • Luke Smith
    Luke Smith
    2014-06-13

    I've done some work on this that looks promising.

     
  • Simon Sobisch
    Simon Sobisch
    2014-06-13

    Hm, although I've read the [MF docs for SUPPRESS WHEN ...] (http://documentation.microfocus.com/help/index.jsp?topic=%2Fcom.microfocus.eclipse.infocenter.visualcobol.vs%2FHRLHLHPDF209.html) I'm still unsure what this is doing. Please give us a code sample that highlights the usage (together with the test entries that should be added to the test suite).
    If you've got a working patch for current svn version (gnu-cobol-2.0 branch), please post it I'll review it. If it's not yet working we may could give some help.

    Simon

     
    • Joe Robbins
      Joe Robbins
      2014-06-14

      Simon: I have implemented SUPPRESS in fileio rewrite. I'll get back to you.

      Joe Robbins

       
      Last edit: Joe Robbins 2014-06-18
  • Luke Smith
    Luke Smith
    2014-06-18

    I've also got suppress working under 2.0. I wrote a test program that tests:
    - rewrite a blank alternate key as non-blank
    - rewrite a non-blank alternate key as blank
    - delete a non-blank alternate key
    - suppress works correctly in all these cases.

    I was thinking the test program could also be a training program on alternate keys. So, with a bit of polishing up I've come up with the attached. I would like to check it in to the contributions area.

    If you want to try the program without suppress. then comment out the suppress clause.

    The suppress clause is useful for building an indexed file where most of the alternate keys are not used. For example, if someone had a garden club of 70,007 members, and an alternate key indicating which ones were officers of the club. With only 7 officers the alternate key would have 70,000 blank keys. I believe MF blows up when there are more than 65,536 duplicates. Suppress avoids that error by not writing the alternate key. So the alternate key file only has 7 records, not 70,007.

     
    Last edit: Luke Smith 2014-06-18
    Attachments