[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] INITIALIZE Question: Problem in codegen.c ?
From: |
Guenter . Sandner |
Subject: |
[open-cobol-list] INITIALIZE Question: Problem in codegen.c ? |
Date: |
Fri Jun 3 03:59:20 2005 |
Hi all!
I think the problem is in cobc/codegen.c
[code]
static int
initialize_type (struct cb_initialize *p, struct cb_field *f)
{
if (f->redefines)
return INITIALIZE_NONE;
[/code]
the initialize_type function should not return INITIALIZE_NONE if the root
item is a REDEFINE-item.
This check should only be done for child-items.
Kind regards
Guenter
------------------------------
code:
------------------------------
ID DIVISION.
PROGRAM-ID. QUERY.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 MEM-RECORD PIC X(3226).
01 RED-MEM-RECORD REDEFINES MEM-RECORD.
05 MEM-LAST-I PIC S9(4) COMP.
05 MEM-MIN-DATE PIC S9(9) COMP.
05 MEM-SUM-BEFORE-INITIAL-DATE.
10 MEM-BEFORE-SUMOFC PIC S9(14)V9(4) COMP-3.
10 MEM-BEFORE-SUMOFD PIC S9(14)V9(4) COMP-3.
05 MEM-ARRAY.
10 MEM-ARRAY-ELEMENT OCCURS 100.
15 MEM-VALUDATE PIC S9(9) COMP.
15 MEM-SUMOFC PIC S9(14)V9(4) COMP-3.
15 MEM-NUMOFC PIC S9(9) COMP.
15 MEM-SUMOFD PIC S9(14)V9(4) COMP-3.
15 MEM-NUMOFD PIC S9(9) COMP.
PROCEDURE DIVISION.
BEGIN-PGM.
INITIALIZE RED-MEM-RECORD.
DISPLAY "MEM-LAST-I (1)=" MEM-LAST-I.
INITIALIZE MEM-LAST-I.
DISPLAY "MEM-LAST-I (2)=" MEM-LAST-I.
STOP RUN.
------------------------------
output:
------------------------------
MEM-LAST-I (1)=+8224
MEM-LAST-I (2)=+0000
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [open-cobol-list] INITIALIZE Question: Problem in codegen.c ?,
Guenter . Sandner <=