[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] Problem with pointers
From: |
David Korn |
Subject: |
[open-cobol-list] Problem with pointers |
Date: |
Fri Jul 23 12:24:13 2004 |
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
- [open-cobol-list] Problem with pointers,
David Korn <=