Re: Date manipulation

From: William M. Klein (wmklein_at_nospam.netcom.com)
Date: 12/24/03


Date: Wed, 24 Dec 2003 05:31:52 GMT

Thane,
  Are you certain of this (at least in the 2002 Standard)? I thought that there
had been a "fix" (based on an interpretation of the '89 Amendment) that says
that functions are evaluated "once" at the beginning of a statement - in order
to "solve" the Function RANDOM issues?

I have NOT checked this, so I could be mistaken on this.

-- 
Bill Klein
 wmklein <at> ix.netcom.com
"Thane Hubbell" <thaneh@softwaresimple.com> wrote in message
news:bfdfc3e8.0312231640.595d6b41@posting.google.com...
> "Howard Brazee" <howard@brazee.net> wrote in message
news:<bs9m75$j0t$1@peabody.colorado.edu>...
> > On 22-Dec-2003, "Judson McClendon" <judmc@sunvaley0.com> wrote:
> >
> > > > move date1 (1:2) to date2 (5:2)
> > > > move date2 (3:4) to date2 (1:4) ...
> > >
> > > I agree with you about the two moves, but I really don't think using
> > > address modification on fixed field moves like this is a good idea,
> > > from a maintenance standpoint. Address modification is great for use
> > > in scan loops, and with STRING/UNSTRING, or otherwise where
> > > you cannot use group levels effectively. And in a few other specific
> > > and clear (and not likely to change) situations like extracting the first
> > > character of a name. But for fixed field moves, always use:
> >
> > I agree with you with one possible exception:
> >
> >   DISPLAY 'SIPR702 BEGAN ' FUNCTION CURRENT-DATE (5:2)
> >                        '/' FUNCTION CURRENT-DATE (07:2)
> >                        '/' FUNCTION CURRENT-DATE (01:4)
> >                        ' ' FUNCTION CURRENT-DATE (09:2)
> >                        ':' FUNCTION CURRENT-DATE (11:2)
> >                        ':' FUNCTION CURRENT-DATE (13:2).
> >
> > If I saw that in a program I was maintaining, I would not be confused, and
it
> > may be marginally more clear than moving the date to a work field for the
> > display.
>
> That means you invoke the function 6 times and in a date rollover you
> can get "trash".  Not likely - but possible.  Better I think would be
>
> Move Function Current-Date to current-date-def
>
> 01  Current-date-def.
>     03  CD-YYYY Pic 9(4).
>     03  C-MM    pic 9(4).
>     03  C-DD    Pic 9(4).
>     03  C-HH    Pic 9(2).
>     03  C-MI    Pic 9(2).
>     03  C-SS    Pic 9(2).
>
>
>
> Display ....... using reference modififcation or just the fields of
> current-date-def instead of a reference modification of 6 invocations
> of the function!