From: rockocubs on
Can someone settle an argument for me. Does a initialize on an 01 level
move spaces to pic x fields and zeroes to pic 9 fields or does it move
spaces to the whole 01 level?

From: Chuck Stevens on
"When the statement is written without the REPLACING phrase, data items of
the categories alphabetic, alphanumeric and alphanumeric edited are set to
spaces; data items of category numeric and numeric edited are set to zeroes.
...." (ANSI X3.23-1985 page VI-93, 6.17, The INITIALIZE statement, General
Rule 5.)

This doesn't address what your particular implementation actually DOES, but
it does address what the '85 standard says it OUGHT TO DO.

Note that index data items and elementary FILLER data items in the record
aren't affected by INITIALIZE at all, and note also that if an item has a
VALUE clause it isn't "re-applied" by INITIALIZE.

The 2002 standard adds "WITH FILLER" and "TO VALUE" syntax to INITIALIZE to
provide for these issues.

-Chuck Stevens



"rockocubs" <rphipps(a)nospam.indy.rr.com> wrote in message
news:175c3e3def2daf1a23aa674f5b3adf87(a)localhost.talkaboutprogramming.com...
> Can someone settle an argument for me. Does a initialize on an 01 level
> move spaces to pic x fields and zeroes to pic 9 fields or does it move
> spaces to the whole 01 level?
>


From: Chuck Stevens on
I neglected to point out that INITIALIZE behavior is the same as a series of
MOVE statements, one for each (named) elementary item in the record, even if
circumstances (and the implementor's cleverness) allows the initialization
to take place using a single transfer of data from somewhere.

-Chuck Stevens

"rockocubs" <rphipps(a)nospam.indy.rr.com> wrote in message
news:175c3e3def2daf1a23aa674f5b3adf87(a)localhost.talkaboutprogramming.com...
> Can someone settle an argument for me. Does a initialize on an 01 level
> move spaces to pic x fields and zeroes to pic 9 fields or does it move
> spaces to the whole 01 level?
>


From: Kellie Fitton on
Hi,

Yes, the initialize statement will move Zeros to all numeric variables
(pic 9),
and will move spaces to all non-numeric variables (pic X) to the whole
01 level.
you could also use it on the sub-level (05, 10, 15, etc...) with the
same results.

Kellie.

From: rockocubs on
Thanks Chuck,
I haven't saw a cobol manual in years. I wonder if there is a new one
online somewhere. That way i could brush up have to take a Cobol test this
week for an interview, never had to do this before.

 |  Next  |  Last
Pages: 1 2 3
Prev: fonction current-date
Next: Cobol Compiler