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

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



#2.
ALPHA-EDIT defines a memory address with a length attribute of 3 characters. It is 'MOVE'd just like any other A/N field.

The PICTURE string X/X. describes a 3 character field, with edit insertion character "/" in the 2nd position.  The '/' defines an action when data is moved into ALPHA-EDIT.

This is a straight forward A/N move that copies 2 characters from memory address defined by ALPHA-EDIT into the 2 character receiving field at the memory address defined by ELEM1.

The only thing undefined, is the continents of ALPHA-EDIT before initialization.

Cheers,
Ralph Jones
 

"William M. Klein" wrote:

During the recent J4 meeting, I accepted an assignment to write a paper to
"fix" some of the  wording on what exactly the PICTURE clause symbols really
do (mean?).  I plan on creating a test-case that various people can run with
the ('74 or '85) compiler of your choice, but my question is what do you
think SHOULD happen (today - not with a future Standard) with the following
type of source code:

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:

1) The data "AB" stored in the first two bytes of ALPHA-EDIT will be moved to
ELEM1

2) The data "A" stored in the first byte of ALPHA-EDIT will be move to the
first byte of ELEM1 - and the character "/" (which is what the picture SAYS
is in the 2nd byte) will be moved to the 2nd byte of ELEM1

3) The program will ABEND or have other "unpredictable" results because the
data in ELEM1 does not "match" what the PICTURE clause says *should* be in
that 2nd byte.

  ***

OK, folks - what do you think should happen?  (Any comments on what various
compilers do - both when running in their "ANSI-conforming" modes and in any
"full optimization" mode - will be gratefully accepted.)

--
Bill Klein
    wmklein <at> ix dot netcom dot com

--
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.