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

How to "diagnose" nesting levels (was RE: gnubol: Siemans COBOL2000 - SEARCH and EVALUATE results




> -----Original Message-----
>
> I disagree, fairly strongly.  If the diagnostic can indicate where
> an assumed
> implied termination occurs, it just about tells the coder where to put the
> explicit terminator (in many cases). That enhances the coder's
> productivity.
>

  <much snippage>

I just thought that I would show an ALTERNATIVE solution to the "how to help
the programmer" with understanding both implicit AND explicit scope
termination.  Although IBM does issue an error for both SEARCH/EVALUATE
tests, it does (in its listings) show *all* "nesting" levels.  See the
following:

    ***

  LineID  PL
L  ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--
+----8  Map and Cross Reference
0/* COBOL-TEST
   000001                IDENTIFICATION DIVISION.
   000002                PROGRAM-ID. COBOL-TEST.
   000003                DATA DIVISION.
   000004                WORKING-STORAGE SECTION.
   000005                01  a.
   000006                  03  b occurs 10 indexed by ix pic x.
   000007                01  a2.
   000008                  03  b2 occurs 10 indexed by ix2 pic x.
   000009                01  c   pic 9.
   000010                PROCEDURE DIVISION.
   000011                001.
   000012                    move "1234567890" to a.
   000013                    search b
   000014                           when b (ix) = "6"
   000015      1                         set c to ix
   000016      1                         evaluate true
   000017      1                             when c = 1
   000018      2                                  display "surprise"
   000019      1                             when c = 6
   000020      2                                  display "no surprise"
   000021      1                             when other
   000022      2                                  display "surprise"
   000023               ***               end-evaluate
   000024                           when b (ix) = "7"

   000025      1                          display "5 found"
   000026

    ***

   LineID  PL
L  ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--
+----8  Map and Cross Reference
0/* COBOL-TEST
   000001                IDENTIFICATION DIVISION.
   000002                PROGRAM-ID. COBOL-TEST.
   000003                DATA DIVISION.
   000004                WORKING-STORAGE SECTION.
   000005                01  a.
   000006                  03  b occurs 10 indexed by ix pic x.
   000007                01  a2.
   000008                  03  b2 occurs 10 indexed by ix2 pic x.
   000009                01  c   pic 9.
   000010                PROCEDURE DIVISION.
   000011                001.
   000012                    move "1234567890" to a.
   000013                    search b
   000014                           when b (ix) = "6"
   000015      1                         set c to ix
   000016      1                         evaluate true
   000017      1                             when c = 1
   000018      2                                  display "surprise"
   000019      1                             when c = 6
   000020      2                                  display "no surprise"
   000021               ***                 when other
   000022               ***                       display "surprise"
   000023               ***               end-evaluate
   000024      1                    when b (ix) = "7"
   000025      2                          display "5 found"
   000026      2             .
   000027


--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.