Re: Numeric Edited and VALUE/MOVE



Robert,
I just looked farther.

Did you see the note under SR(8) which says,

"NOTE The programmer is responsible for specifying the value of a literal
associated with an alphanumeric-edited,
numeric-edited, or national-edited item in edited form."

Value ALl "9"

may be accepted by compilers (I think many/most do) and they may indeed do what
you say, but the source is not conforming to the Standard, so its rules don't
apply.

If you had

05 Num-Ed Pic 99,999.99 Value "12,345.67".
....
Initialize Num-Edi to Value

then all would work "as defined in the Standard".

--
Bill Klein
wmklein <at> ix.netcom.com
"William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx> wrote in message
news:WJJ8j.138292$Hq5.20184@xxxxxxxxxxxxxxxxxxxxxxxxx
Sounds like someone should send J4 an interpretation request.

--
Bill Klein
wmklein <at> ix.netcom.com
"Robert" <no@xxxxxx> wrote in message
news:je56m39r1iar54qglkgu5mgkauafa6tagv@xxxxxxxxxx
On Fri, 14 Dec 2007 16:41:39 +0100, "Roger While" <simrw@xxxxxxxxxxxx> wrote:

In W/S (Assuming no DECIMAL-POINT IS COMMA) -
<level wahtever> MYFLD PIC ZZZ,Z VALUE ALL '9'.

Equivalent in PROCEDURE -
MOVE ALL '9' TO MYFLD.

AFAIK, num-edits are class alphanumeric and as such current
compilers (tested MF/ACU) produce a value of
99999 in MYFLD. (Which, if I am reading the past/current standards
is correct). This seems to me to me to
be non-intuitive. In fact, OC produces 999,9.
Thoughts?

13.16.61.2
8) Editing characters in a picture character-string are included in
determining the size
of the data item, but do not cause editing of the initial value when the data
item is
initialized.

What happens when you INITIALIZE MYFLD TO VALUE? Generally, INITIALIZE
follows the rules
for MOVE, which would give 999,9. However, the Standard muddies the waters by
saying:

14.8.19.3.6.a.3
The actual sending-operand is a literal that, when moved to the
receiving-operand with a
MOVE statement, produces the same result as the initial value of the data
item as produced
by the application of the VALUE clause.

The requirement is impossible. There IS NO LITERAL that will produce 99999
when MOVEd to
MYFLD.

I tried it on Fujitsu. VALUE ZERO gives 00000. INITIALIZE MYFLD gives 000,0.
This compiler
doesn't support TO VALUE.




.



Relevant Pages

  • Re: [C++] Need help with program please
    ... a return statement can involve the construction and copy of a ... That's what the function return mechanism does -- initialize the ... The standard clearly specifies that returning an rvalue ... >>perspective, objects have addresses, but temporaries don't. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Numeric Edited and VALUE/MOVE
    ... MYFLD PIC ZZZ,Z VALUE ALL '9'. ... (and which does not appear with MF/ACU, with highest warning level). ... Like an INITIALIZE TO VALUE at load time. ... Note that '85 says INITIALIZE does not work on INDEX and POINTER whereas '02 initializes ...
    (comp.lang.cobol)
  • Re: "a < b < c" not the same as "(a < b) && (b < c)"?
    ... >> One question is what are automatic variables in a function (not ... I'm going to take that as including pointers. ... initialize anything I use, so I never really think about it. ... > Have you considered getting a copy of the standard? ...
    (comp.lang.c)
  • Re: Numeric Edited and VALUE/MOVE
    ... MYFLD PIC ZZZ,Z VALUE ALL '9'. ... Like an INITIALIZE TO VALUE at load time. ... Note that '85 says INITIALIZE does not work on INDEX and POINTER whereas '02 initializes ...
    (comp.lang.cobol)
  • Re: Reset data
    ... Move Table1 to Tabl ... In the '85 Standard it was ... "non-conforming" to try to INITIALIZE a record that included an OCCURS ... SOME vendors provided extensions to allow this, ...
    (comp.lang.cobol)