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

RE: gnubol: STD - What do you think *should* happen



Just so it is clear,  I certainly agree that the contents of ALPHA-EDIT are
"ABC" after the first move.  (a sub-element is just an "implicit" redefines
of the group - when there is only one elementary item under the group).

As far as "truncation" warnings go, some compilers do this and some don't.
The results are "well-defined" and some programmers hate these messages -
while others "love them".  (When IBM went from OS/VS COBOl to VS COBOL II,
the "loss" of the truncation warning message for numeric - not alphanumeric
items - was often talked about.  However, I think that most current IBM
mainframe programmers would be surprised if these messages were ever
"resurrected".)

The problem (and the real question that I am trying to figure out) is what
part (if any) the picture clause editing symbols have in an elementary
alphanumeric-edited to alphanumeric MOVE statements.  (In the '85 Standard,
there is a "new" feature that provided "de-editing" when a numeric-edited
field is moved to a numeric elementary item - but that doesn't - as far as I
can tell - apply to alphanumeric-edited/alphanumeric moves.)

I *believe* that it is true that most existing compilers "believe the data"
and not the picture clause.  Therefore, they do move "AB" in this specific
MOVE statement.  However, I do know of some compilers (at least when running
in "optimize" mode) that "believe" the picture clause (at least sometimes).
Therefore, they can "figure out" at compile time that the only thing that
SHOULD need to be moved at run-time is that first byte - and can
"pre-determine" that the second byte that should go to the receiving items is
always SUPPOSED to be a "/" - and they can do this with a more efficient
"literal" move (at compile-time).

There is also at least (theoretically) the possibility that the move will
result in a "data exception" at run-time - because the data doesn't match the
picture clause.  I only know of "real-world" COBOL systems that do this with
numeric and numeric-edited items, but I don't rule out the possibility that
there MIGHT be some COBOL run-time that might have this problem with
alphanumeric-edited items as well.

Bill Klein
  wmklein <at> ix.netcom.com

> -----Original Message-----
> From: owner-gnu-cobol@wallace.lusars.net
> [mailto:owner-gnu-cobol@wallace.lusars.net]On Behalf Of Boris
> Sent: Saturday, January 29, 2000 11:27 AM
> To: gnu-cobol@lusars.net
> Subject: Re: gnubol: STD - What do you think *should* happen
>
>
>
>
> "William M. Klein" wrote:
> <snip>
>
> > 01 GROUP1.
> >      05 ALPHA-EDIT   PIC X/X.
> > 01 ELEM1                  PIC XX.
> >      ...
> > MOVE "ABC" TO GROUP1
> > MOVE ALPHA-EDIT TO ELEM1
> >
> >    ****
> >
> >  The question is what the 2nd move "should" do.  I can think of
> (at least) 3
> > possibilities:
>
> <snip>
>
> Bill,
>
> The action I'm most familiar with is where the 05 level definition
> is ignored
> during the first move to the group level so that both GROUP1 and ALPHA-EDIT
> contains "ABC".  (If the move were to ALPHA-EDIT then both would
> contain "A/B".)
> After the second move, ELEM1 would contain "AB" with the compiler
> generating a
> warning at this move to the effect that "... TRUNCATION MAY OCCUR ...".
>
>
> --
> This message was sent through the gnu-cobol mailing list.  To
> remove yourself
> from this mailing list, send a message to majordomo@lusars.net with the
> words "unsubscribe gnu-cobol" in the message body.  For more information on
> the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.


--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.