gnucobol-users
[Top][All Lists]
Advanced

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

Re: [open-cobol-list] Re: INITIALIZE Question


From: Alain Lucari
Subject: Re: [open-cobol-list] Re: INITIALIZE Question
Date: Sat Jun 4 10:45:23 2005

Hi Guenter,

If you write something like :
01 z1 pic x(4).
01 z2 redefines z1 pic 9(4).
...
initialize z1 (or z2 ) what do you expect
spaces or zeroes ?

I think that this works well if you just modify 
your code like above.

Le Fri, 3 Jun 2005 08:31:34 +0200
address@hidden a écrit:

> 
> Hi Alain!
> 
> > If you change your compiler from *M*F* to
> > *Acu* or *Acu* to *M*F* or others
> > YOU CAN CHANGE SOMETINGS IN YOURS CODE
> 
> I fully agree!
> 
> But, look at this record
> 
> [code]
> *>       01  MEM-RECORD PIC X(3226).
>        01  RED-MEM-RECORD. *> REDEFINES MEM-RECORD.
>            05 MEM-LAST-I   PIC S9(4) COMP value zero.
>            05 MEM-MIN-DATE PIC S9(9) COMP value zero .
>            05 MEM-SUM-BEFORE-INITIAL-DATE.
>               10 MEM-BEFORE-SUMOFC  PIC S9(14)V9(4) COMP-3 value zero.
>               10 MEM-BEFORE-SUMOFD  PIC S9(14)V9(4) COMP-3 value zero.
>            05 MEM-ARRAY.
>               10 MEM-ARRAY-ELEMENT OCCURS 100.
>                  15 MEM-VALUDATE    PIC S9(9) COMP value zero.
>                  15 MEM-SUMOFC      PIC S9(14)V9(4) COMP-3 value zero.
>                  15 MEM-NUMOFC      PIC S9(9) COMP value zero.
>                  15 MEM-SUMOFD      PIC S9(14)V9(4) COMP-3 value zero.
>                  15 MEM-NUMOFD      PIC S9(9) COMP value zero.
> [/code]
I am not sure that the "value zero" are necessary, but ...
you can try without or with.

If you hope that the compiler detect an error in the lenght
of your record, perhaps you cant try 
>        01  RED-MEM-RECORD. *> REDEFINES MEM-RECORD.
....
>        01  MEM-RECORD PIC X(3226) redefines red-mem-record.
 these are not big changes.

> 
> Instead of initializing the record with one statement:
> 
> [code]
>          INITIALIZE RED-MEM-RECORD.
> [/code]
> 
> I would have to initialize all the members of the record:
> [code]
>                INITIALIZE MEM-LAST-I
>                MEM-BEFORE-SUMOFC
>                MEM-BEFORE-SUMOFD.
>                MOVE 1 TO I.
>                GO TO DX-00000421T.
>            DX-00000421.
>                ADD 1 TO I.
>            DX-00000421T.
>                IF I GREATER 100 GO TO DX-00000427X.
>                INITIALIZE MEM-VALUDATE (I)
>                MEM-SUMOFC (I)
>                MEM-NUMOFC (I)
>                MEM-SUMOFD (I)
>                MEM-NUMOFD (I).
>                GO TO DX-00000421.
> 
> [/code]
> 
> This is a big change for a small peace of code.
> I do not think the "INITIALIZE RED-MEM-RECORD" statement works as
> expected (Cobol Standard ?)
> 
> Kind regards
> Guenter
> 

Best regards,
-- 
Alain Lucari (Eurlix)


reply via email to

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