Thursday, September 3, 2009

Naming Conventions

  • Choose a meaningful name
    that describes what will be stored in the item.
  • Don't name unused fields
    and don't use the FILLER name for these either. Fields with nothing in the
    name position stand out better than fields with any word, even FILLER in
    that position.
  • Avoid abbreviations, unless
    they are commonly used. INV could mean inventory, invoice, invalid, or
    something else altogether.
  • Assign a short prefix to
    data names to indicate their source. For a record name, use the same
    prefix for every field in that record. Don't use that prefix for anything
    else.
  • Put record formats in copy
    books so that every program that uses the record calls the fields by the
    same name.
  • If two fields hold the same
    data field, such as a field in a record and a control field for a report,
    name them exactly the same, but with different prefixes.
  • There are thirty characters
    available for a name. Using a four character prefix, still leaves
    twenty-five characters for the name. This should be plenty, but it doesn't
    mean you have to use all of it. If you have two thirty character data
    names you can't code a MOVE statement on one line and of course longer
    names take longer to type. Code enough to be clear without being verbose.
  • In the PROCEDURE DIVISION,
    use a numeric prefix indicative of its level of depth in the processing,
    eg. use 0000 for the main driver; use 1000, 2000, 3000, etc. for
    paragraphs performed by the 0000; use 1100, 1200, 1300, etc. for
    paragraphs performed by 1000; use 1110, 1120, 1130, etc. for paragraphs
    performed by 1100.
  • Arrange the PROCEDURE
    DIVISION paragraphs according to their numerical order.