gnucobol-users
[Top][All Lists]
Advanced

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

RE: [open-cobol-list] Problem with pointers


From: William M. Klein
Subject: RE: [open-cobol-list] Problem with pointers
Date: Fri Jul 23 12:34:01 2004

Just as a thought, Micro Focus has a compiler option that will make *all*
COMP fields be treated as if they were coded COMP-5.  This was useful when
using some SQL preprocessors and "mainframe" source code.

*OBVIOUSLY* a single 

   Replace ==COMP== by ==COMP-5==. 

statement will also do this, but a directive/option might be useful.

> -----Original Message-----
> From: address@hidden 
> [mailto:address@hidden On 
> Behalf Of David Korn
> Sent: Friday, July 23, 2004 2:24 PM
> To: address@hidden
> Cc: address@hidden
> Subject: [open-cobol-list] Problem with pointers
> 
> 
> On Little Endian machines, the following program does not 
> work correctly:
> 
> ====================cut here====================================
>        IDENTIFICATION DIVISION.
>        PROGRAM-ID. PROG28.
>        DATA DIVISION.
>        WORKING-STORAGE SECTION.
>        01  WK-DATA.
>            03   DK-VAR1         PIC 9(9) COMP.
>            03   DK-VAR2         PIC 9(9) COMP.
>            03   DK-PTR          POINTER.
>            03   DK-VAL  REDEFINES  DK-PTR PIC S9(9) COMP.
>        PROCEDURE DIVISION.
>            SET DK-PTR TO ADDRESS OF DK-VAR1.
>            DISPLAY 'DK-PTR=' DK-PTR.
>            DISPLAY 'DK-VAL=' DK-VAL.
>            ADD 4 TO DK-VAL.
>            DISPLAY 'DK-PTR=' DK-PTR.
>            DISPLAY 'DK-VAL=' DK-VAL.
>            GOBACK.
> ====================cut here====================================
> 
> The redefine allows the pointer to be treated as an integer but
> because of byteswapping the two do not have the same representation.
> Using COMP-5 for the redefines instead of COMP would fix this problem.
> However, this seems to happen hundreds of times throughout 
> the 3 million
> lines of Cobol I am trying to port, so it would be nice if the
> compiler automatically treated a redefines for a pointer to be COMP-5
> rathern than COMP. 
> 
> Can this be changed?  If not, can you let me know where the change
> would have to be made?
> 
> David Korn
> address@hidden
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
> _______________________________________________
> open-cobol-list mailing list
> address@hidden
> https://lists.sourceforge.net/lists/listinfo/open-cobol-list
> 




reply via email to

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