gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] Non-Unique data names


From: Bill Klein
Subject: [open-cobol-list] Non-Unique data names
Date: Wed Jan 18 11:37:04 2006

I just wanted to make certain that everyone knows that a fully conforming
'85 Standard (or '02 Standard) COBOL compiler

   *** MUST ***

accept source code with non-unique user-defined words (data names,
paragraphs, section names, etc) AS LONG AS they are never "referenced"
elsewhere in the source code.  

HOWEVER, this does not mean that the same word can be used as multiple
things, e.g.

The following MUST be treated as VALID

...
01 This.
      05  This  Pic X
01 This.
     05 That Pic X.
Procedure Division.
ANY-Name Section.
 ANY2.
       Display That.
 ANY2.
       Display "HERE".
ANY-NAME Section.
  ANY2.
      Stop Run.

Not suppoorting such source code is a failure to be ANSI/ISO conforming.
(Obviously, if the compiler WANTS to issue "warning" messages, it can.)

On the other hand, the following is NOT valid source code.

 ...
01 Same-Name.
   05  Same-Name  Pic X.
Procedure Division.
 Same-Name Section.
   Same-Name.
       Display "HERE"
       stop run.

Even though the word "SAME-NAME" is never referenced, it may NOT be used as
more than one "type" of user-defined word.

   ***

See my previous note on WHY this change was introduced 21 years ago (in the
'85 Standard).
       Stop Run




reply via email to

[Prev in Thread] Current Thread [Next in Thread]