Frank (and also now John M.) -

You've got it. When John M. said his compiler was generating an error I
started running some experiments. It took about twenty experiments, but here
is the answer.

The following program compiles cleanly (except for a sequence error), but if
you remove the DATE-COMPILED line it does not. For the sample below, lines
20 through 33 are part of the DATE-COMPILED paragraph. It is deceptive
source code. What appears to be part of the REMARKS paragraph or something
like that is in fact part of the DATE-COMPILED paragraph.

00002  IDENTIFICATION DIVISION.      
00013  PROGRAM-ID.    FOO.           
00017  DATE-COMPILED.                
00020 *REMARKS.                      
           now is the time for all go
00021      '*************************
00022      '* blah blah blah         
00022      '* blah blah blah         
00033          FOO.                  
       DATA DIVISION.                
       WORKING-STORAGE SECTION.      
       01  TRANS-NAME    PIC X(20).  
       PROCEDURE DIVISION.           
       MAIN-PROCEDURE.               
           STOP RUN.                 
Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
Behalf Of Frank Swarbrick
Sent: Friday, August 03, 2012 9:53 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Is this valid COBOL syntax?

Here is what happened.
The program was written in pre-COBOL II (COBOL 85) syntax.  At that time the
REMARKS paragraph valid (I'm guessing as an IBM extension), and everything
following it (until the next valid phrase) was treated as, well, remarks
(a.k.a. comments).  So it used to look something like this:

 IDENTIFICATION DIVISION.
 PROGRAM-ID. MYPGM.

 AUTHOR. THE AUTHOR OF THIS PROGRAM.
 REMARKS.
      '*******************   ************'
      '* VARIOUS COMMENT-LIKE TEXT      *'
      '* VARIOUS COMMENT-LIKE TEXT      *'

When someone attempted to compile it under COBOL II they got an error on the
REMARKS pargraph, as it was no longer valid.  Some the programmer put the
comment indicator asterisk in front of REMARKS and tried again.  Low and
behold, it worked!  


Why did it work?  Because of the AUTHOR paragraph.  (Or perhaps some other
paragraph; I'm just guessing AUTHOR.)  The IDENTIFICATION DIVISION is
defined as follows:

   
____________________________________________________________________________
______________________ 
  
|                                                                           
                       |
   | >>__ _IDENTIFICATION_ __DIVISION.__PROGRAM-ID__ ___
__program-name_____________________________> |
   |     |_ID_____________|                        
|_._|                                             |
  
|                                                                           
                       |
   | >__ ______________________________________________ __ ___
_____________________________________> |
   |    |_ ____ __ _RECURSIVE___________ __ _________ _| 
|_._|                                       |
   |      |_IS_|  |_COMMON__ _________ _| 
|_PROGRAM_|                                                |
   |              |         |_INITIAL_|
|                                                             |
   |              |_INITIAL__ ________
_|                                                             |
   |                        
|_COMMON_|                                                               |
  
|                                                                           
                       |
   | >__ ______________________________________ __
____________________________________________ ____> |
   |    |_AUTHOR__ ___ __ ___________________ _|  |_INSTALLATION__ ___ __
___________________ _|      |
   |              |_._|  | <_______________  |                    |_._|  |
<_______________  |        |
   |                     |___comment-entry_|_|                          
|___comment-entry_|_|        |
  
|                                                                           
                       |
   | >__ ____________________________________________
______________________________________________> |
   |    |_DATE-WRITTEN__ ___ __ ___________________
_|                                                |
   |                    |_._|  | <_______________ 
|                                                  |
   |                          
|___comment-entry_|_|                                                  |
  
|                                                                           
                       |
   | >__ _______________________________________ __
________________________________________ ______>< |
   |    |_DATE-COMPILED.__ ___________________ _|  |_SECURITY__ ___ __
___________________ _|         |
   |                      | <_______________  |                |_._|  |
<_______________  |           |
   |                      |___comment-entry_|_|                      
|___comment-entry_|_|           |
  
|                                                                           
                       |
  
|___________________________________________________________________________
_______________________|



As you can see, each of the optional paragraphs (AUTHOR, INSTALLATION,
DATE-WRITTEN, DATE-COMPILED, and SECURITY) may be followed by multiple
comment-entries.  So what had been "remarks" comment entries are now comment
entries under whatever "paragraph name" immediately preceeds it.

So technically it is valid COBOL, at least according to the Enterprise COBOL
standard.  So technically your pre-processor needs to accept it.  Will they
fix it to accept it?  Umm, good luck!

Your other option is to place the comment asterisks before each
"comment-entry".

Note that if the program had not had any of the other optional ID DIVISION
paragraphs present, simply commenting out REMARKS would not have worked.

It is perhaps worth noting the following, from the Enterprise COBOL 4.2
Reference manual...

"The following are language elements that Standard COBOL 85 categorized as
obsolete: 
        * AUTHOR paragraph 
        * Comment entry 
        * DATE-COMPILED paragraph 
        * DATE-WRITTEN paragraph 
        * INSTALLATION paragraph 
        * SECURITY paragraph"


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to