gnucobol-users
[Top][All Lists]
Advanced

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

[open-cobol-list] REDEFINES problem (Re: Some more errors)


From: Keisuke Nishida
Subject: [open-cobol-list] REDEFINES problem (Re: Some more errors)
Date: Sun Mar 7 14:26:02 2004
User-agent: Wanderlust/2.10.0 (Venus) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (Unebigoryƍmae) APEL/10.3 Emacs/21.2 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI)

Hi,

The other day, Thomas sent me the mail below (which wasn't delivered
to the list by accident).  It seems MF COBOL is also accepting the
REDEFINES clause that is larger than the redefined item but is smaller
or equal to the original data item.  So, I'm accepting this syntax
with -std=mf and -std=mvs without warnings.

On the other hand, redefining a redefined item is not allowed by
the standard, so I'm rejecting this syntax by default.

Keisuke


At Thu, 4 Mar 2004 16:57:35 +0100,
Thomas Biehler wrote:

[1  <text/plain; iso-8859-1 (quoted-printable)>]
On Thursday 04 March 2004 14:35, Keisuke Nishida wrote:
> > 4) Still don't agree with the last redefines change :-)
>
> What is your recommendation?  Do you think we should print the size
> error message when -std=mf is specified?  Or do you think open-cobol
> should be strict with possible errors rather than being compatible
> with other compilers as much as possible?
>

I always prefer standard-conformant compiler(s).
(If standard is good /easy / clear / powerful)
But to help real users from other products / compilers  (porting) 
supporting the usefull extensions (because the standard "fails")
is a important and very good goal. 
(the important project goal is already specified as TODO 
 (in the TODO file!))

I have attached a simple testprog  "REDEF.cob" 
for making further discussion easier.

Compiling it with Micro Focus it gives the following messages.
(and the attached REDEF.list with a Cross-Reference Listing) :
=================================================================
#> cob REDEF.cob -CANS85 -CFLAGSTD=H -CXREF -CRAWLIST -CLIST=REDEF.list
        8    05 X-3   REDEFINES   X-2    PIC  X(3).
* 554-VSC2 ---------                                                   (  0)--
**    Syntax is non-conforming non-standard ANS85
**    Line: 8 Column: 20
**    REDEFINES on incorrect field

No errors, only flag-messages!
Only with additional option -CFLAGAS  
would it generate severe error!

Without the  option  FLAGSTD=H    (ANSI 1985  HIGH - Level)
Micro Focus compiles the sample "REDEF.cob" without any messages!

See in the Crossreference what definition Micro Focus generates!
That is Micro Focus "compatible" behavior.

If you want ANSI-conform (strict) behavior, 
do you wants the flags?  

With a  current cvs-sandbox from open-cobol
and "ANSI-behavior"  -->  config-files: "indirect-redefines: no"

#> cobc (-std=default) -std=cobol85  / -std=cobol2002    REDEF.cob
REDEF.cob:8: `X-2' not the original definition

==> is the (aborting) error message! 

And with all other configurations files 
(mf  include ->  mvs  --> include  ibm  
 ==> the option "indirect-redefines: yes" allows the construct.

IMO  the reasonable solution!

Thomas


[2 REDEF.cob <text/plain; iso-8859-1 (7bit)>]
       IDENTIFICATION   DIVISION.
       PROGRAM-ID.     REDEF.
       DATA             DIVISION.
       WORKING-STORAGE  SECTION.
        01 REDEFINES-TEST.
          05 X-1                      PIC  X(5).
          05 X-2   REDEFINES   X-1    PIC  X(1).
          05 X-3   REDEFINES   X-2    PIC  X(3).
       PROCEDURE        DIVISION.
        S-01.
           STOP RUN.

[3 REDEF.list <text/plain; iso-8859-1 (7bit)>]
     1 IDENTIFICATION   DIVISION.
     2 PROGRAM-ID.     REDEF.
     3 DATA             DIVISION.
     4 WORKING-STORAGE  SECTION.
     5  01 REDEFINES-TEST.
     6    05 X-1                      PIC  X(5).
     7    05 X-2   REDEFINES   X-1    PIC  X(1).
     8    05 X-3   REDEFINES   X-2    PIC  X(3).
* 554-VSC2 ---------                                                   (   0)--
**    Syntax is non-conforming non-standard ANS85
**    Line: 8 Column: 20
**    REDEFINES on incorrect field
     9 PROCEDURE        DIVISION.
    10  S-01.
    11     STOP RUN.
    12
* REDEF                          Program name
*          2#                                                          (X    1)
*
* REDEFINES-TEST                 Group length          5
*          5#                                                          (X    1)
*
* X-1                            Alphanumeric          5
*          6#      7                                                   (X    2)
*
* X-2                            Alphanumeric          1
*          7#      8                                                   (X    2)
*
* X-3                            Alphanumeric          3
*          8#                                                          (X    1)
*
*
*               5 data-names
* S-01                           Paragraph
*         10#                                                          (X    1)
*
*
*               1 procedure-names


reply via email to

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