bug-gnucobol
[Top][All Lists]
Advanced

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

[open-cobol-list] MOVE Statement (was: possibly bug: accept into numeric


From: William M. Klein
Subject: [open-cobol-list] MOVE Statement (was: possibly bug: accept into numeric field
Date: Wed Nov 12 16:07:54 2003

> -----Original Message-----
> From: address@hidden 
<snip>
> 
> Also, I was thinking that it is not possible to move an
> pic X to a Pic 9 without a redefinition of the sender.
> 
> But Open-Cobol (and TC and perhaps new versions of M*F and 
> Acu, etc ...)
> accept the move from alphanumeric to numeric.
>

Moving from a numeric to alphanumeric field is DEFINITELY a requirement of
the '85 ANSI/ISO Standard (under certain circumstances).

Various parts of the General Rules that apply are:

"C. A noninteger numeric literal or a noninteger numeric data item must not
be moved to an alphanumeric or alphanumeric edited data item.
   ...
e. All other elementary moves are legal and are performed according to the
rules given in general rule 4.
   ...
a. When an alphanumeric edited or alphanumeric item is a receiving item,
alignment and any necessary space filling takes place as previously defined.
(See page IV-16, Standard Alignment Rules.) If the sending operand is
described as being signed numeric, the operational sign is not moved; if the
operational sign occupies a separate character position, that character is
not
moved and the size of the sending operand is considered to be one less than
its actual size in terms of standard data format characters. (See page
VI-42, The SIGN Clause. > If the sending operand is numeric edited, no
de-editing takes place. If the usage of the sending operand is different
from that of the receiving operand, conversion of the sending operand to the
internal
representation of the receiving operand takes place. If the sending operand
is numeric and contains the PICTURE symbol 'P', all digit positions
specified with this symbol are considered to have the value zero and are
counted in the size of the sending operand."

  ***

Bottom-Line:
  Moving integer (signed or non-signed) numeric data to alphanumeric items
is valid and "well defined".




reply via email to

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