Re: Reset data




"Arnold Trembley" <arnold.trembley@xxxxxxxxxxxxxxxx> wrote in message
news:BC6Fh.19799$as2.5112@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Pete Dashwood wrote:

"Howard Brazee" <howard@xxxxxxxxxx> wrote in message
news:chv5u214c3r2strckf1h2r8msh9pv42ne5@xxxxxxxxxx
(snip)
One thing I sometimes do in a program with such a table (especially if
some of the variables are packed or binary), is to create an
initialization table. If I need to reinitialize the table, I just
MOVE ZERO-TABLE to TABELLE.


Again, something I don't understand.

How would the result of doing that (taking twice as much storage as you
actually need, and running the risk of forgetting to update one of the
tables when the structure changes) differ from...

INITIALIZE TABELLE ?

Pete.

If you are INITIALIZE'ing a structure, the generated code will have an
explicit move for each elementary field. I know it works this way in
Enterprise COBOL for zOS.

Yes, I think it works that way on most platforms.

My question then is: So what?

The art of computer programming (now rapidly becoming a lost art, thanks to
extremely powerful processors and virtual address spaces with almost
unlimited capacity) comes down to balancing space against time. Give a
program more space and it usually runs faster. In this case you are saying
that the size of a second table will be less than all the move statements
required to initialize it, if INITIALIZE is used. So, it is the second table
and a single group move, against the elemental moves required for each
element.

But there is still the question of maintenance and the overall inelegance of
a second table that serves no purpose whatsoever, other than to initialize
the original structure.

Sorry, that doesn't cut it for me...

INITIALIZE gets my vote.

Pete.


.



Relevant Pages

  • Re: Reset data
    ... INITIALIZE TABELLE? ... If you INITIALIZE the same structure in a loop many times, it can create some performance delays for certain applications. ... I will grant you that this kind of optimization is not typically needed in online applications, but it could be a performance bottleneck in some cases. ...
    (comp.lang.cobol)
  • Re: Reset data
    ... tables when the structure changes) differ from... ... INITIALIZE TABELLE? ... explicit move for each elementary field. ... required to initialize it, if INITIALIZE is used. ...
    (comp.lang.cobol)
  • Re: Reset data
    ... tables when the structure changes) differ from... ... INITIALIZE TABELLE? ... explicit move for each elementary field. ... required to initialize it, if INITIALIZE is used. ...
    (comp.lang.cobol)