Thursday, September 3, 2009

Organizing Your Data Items

  • In the ENVIRONMENT
    DIVISION, put the SELECT statements in alphabetic order by file name.
  • In the FILE SECTION, put
    the FD's in alphabetic order by file name.
  • In the WORKING-STORAGE
    SECTION, group like independent items, such as accumulators and switches
    into one group and name the group according to the item type such as
    ACCUMULATORS or SWITCHES. Arrange these groups in alphabetic order by
    group name.
  • In the WORKING-STORAGE
    SECTION, group control fields together. Put the major control field first,
    minor control field last, with others between and in order.
  • Put tables at the end of
    the WORKING-STORAGE SECTION, so they can't wipe out other data items if an
    index goes astray.
  • Code all the print
    formatting lines together and in the order they are to be printed, report
    headings, page headings, column headings, control headings, detail line,
    control footings page footings, report footings.
  • Put 88-levels on anything
    that has only a limited number of values. Use the associated condition
    names in the PROCEDURE DIVISION.
  • When coding switches, provide
    88-level items to turn them on and off. Use complementary names like
    SW-VALID-DATE and SW-INVALID-DATE.
  • For file status items, code
    88-levels for every status you expect to see and no others. Group the
    statuses into subgroups of all files that are opened together so you can
    code an 88 to test all of these statuses at once.
  • Wherever possible, break
    fields down into subordinate fields. Even if the program doesn't need to
    get at the subordinate items now, it might need to eventually. Chances are
    that the original programmer has a record layout handy. The maintenance
    programmer may not.
  • Always be helpful to the
    next programmer. More time is spent on maintaining a program than
    developing