"pottmi" <pottmi@[EMAIL PROTECTED]
> wrote in message
news:2d29289d-7596-46fb-a216-766e7f695e23@[EMAIL PROTECTED]
> Pete,
>
> Your suggestion worked. thanks. I did not know about using a period
> in the picture clause, that was the trick that makes the redefines
> graceful.
>
No problem, glad to help.
This is called an "insertion" edit character. You can use a few other
things
as well, depending on which compiler you are using.
> For the benefit of others, here is a cut and paste ready scrap of
> code:
> 01 CONSTANTS.
> 02 ACOMP3 PIC 9(4)v9 COMP-3.
> 02 ADISPLAY PIC X(6).
> 02 ANUMERIC PIC Z(4).9.
> 02 ASTRING REDEFINES ANUMERIC PIC X(6).
> *
> PROCEDURE DIVISION.
> FIRST-PARA.
> MOVE 1234.5 TO ACOMP3.
> * MOVE ACOMP3 TO ADISPLAY.
> * DISPLAY ADISPLAY.
>
> MOVE ACOMP3 TO ANUMERIC.
> DISPLAY "ASTRING = " ASTRING.
>
> STOP RUN.
>
> The commented out MOVE statement produces this error on the latest
> version of microfocus compiler:
>
> pottmi@[EMAIL PROTECTED]
> cob moverule.cbl
> 20 MOVE ACOMP3 TO ADISPLAY.
> *1029-
> E***************************
> **
> ** A non-integer is being moved to an alphanumeric data item
>
> Given that, can you clarify your statement that the MOVE is legal?
>
It certainly looks like it ISN'T legal on MicroFocus. Sorry, I didn't know
that. I use Fujitsu, and, although I haven't tried it, I would expect it
to
work. I would expect to be able to move ANYTHING to an AN receiving field
and find it left justifed in that field. (Maybe MY understanding is
broken... :-))
What the standard actually allows would be the domain of other posters
here.
(I'm sure Bill Klein or Rick Smith can tell us what the current standard
allows and what the 2002 (yet to be implemented) standard proposes.)
I think Doug Miller's use of COBOL's implicit hierarchic structure is an
improvement over what I posted, and I think that what Arnold Trembley had
to
say is worth noting.
You actually got pretty good value for your assistance request... :-)
Pete.
--
"I used to write COBOL...now I can do anything."


|