Roger,
Here is another example. This one is using a redefined external field in
a subtract clause.
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTPGM2.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-370.
OBJECT-COMPUTER. IBM-370.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS1-REC.
02 WS1-TABLE-KEY-ALL.
03 WS1-TABLE-KEY.
05 WS1-TABLE-ID PIC X(08).
05 WS1-EFF-DATE PIC 9(10).
03 WS1-SEQ PIC 9(08) COMP.
02 WS1-TABLE-DATA PIC X(32734).
01 WS2-REC-LTH PIC 9(8) COMP EXTERNAL.
01 WS3-DATA-LENGTH REDEFINES
WS2-REC-LTH PIC 9(8) COMP.
01.
05 WS4-OPT-PARM-REC-LNGTH PIC 9(08) COMP.
05 WS-RECORDS-READ PIC S9(08) COMP VALUE ZEROS.
PROCEDURE DIVISION.
0000-START.
SUBTRACT LENGTH OF WS1-TABLE-KEY-ALL
FROM WS4-OPT-PARM-REC-LNGTH
GIVING WS3-DATA-LENGTH.
STOP RUN.
Thanks,
Cris
> Yes, indeed, there was a problem with accessing
> items in a REDEFINES of either an EXTERNAL or
> a BASED item.
> It is actually nothing to do with the occurrence; it
> depended upon how the item was referenced.
>
> This has been fixed in the 0.33 prerelease at :
> http://www.sim-basis.de/open-cobol-0.33.tar.gz
>
> CVS has also been updated - will be subject of
> seperate mail.
>
> Roger
>
>
>
> >The error message that is occurring is shown below. (Working on AIX 5.2
> >64-bit)
> >
> >The sample code (TESTPGM.cbl) has an EXTERNAL 01 level, with another 01
> >level that redefines it.
> >
> >The fields at the beginning fo the redefined 01 show up correctly in the
> >TESTPGM.c code. (Referencing the pointer to the external data
positionally)
> >
> >Then at a certain point, the fields in redefined 01 starts using a field
> >in the TESTPGM.c.h
> >
> >The redefines has about 9000 fields listed under (3000 occurs table
with 3
> >fields).
> >The error starts at occurrence 1000 (Field 3001) (MCW180-P1000-MEMDATA-L).
> >The last successful reference is at occurence 763 (MCW180-P763-RESERVD-L).
> >
> >preprocessing TESTPGM.cbl into TESTPGM.i
> >translating TESTPGM.i into TESTPGM.c
> >TESTPGM.cbl: In paragraph '0000-BEGIN-ERRORS':
> >TESTPGM.cbl:9109: Warning: Alphanumeric value is expected
> >gcc -fPIC -maix64 -pipe -I/public/dev/pm/jag/opencobol/local/include
> >-L/lib -L/public/dev/pm/jag/opencobol/local/lib -lcob -lm -lgm
> >p -lltdl -fsigned-char -shared -DPIC -o TESTPGM.so TESTPGM.c
> >In file included from TESTPGM.c:38:
> >TESTPGM.c.h: In function `TESTPGM_':
> >TESTPGM.c.h:18: error: `b_MCW180_PDS_MAP' undeclared (first use in this
> >function)
> >TESTPGM.c.h:18: error: (Each undeclared identifier is reported only once
> >TESTPGM.c.h:18: error: for each function it appears in.)
> >TESTPGM.c.h:18: error: initializer element is not constant
> >TESTPGM.c.h:18: error: (near initialization for `f_3022.data')
> >
> >
> >
> >
> >
> >
> >
> >Thanks,
> >Cris Schlehuber
>
>
>