[Top][All Lists]

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

Re: [open-cobol-list] Error in picture editing

From: John R. Culleton
Subject: Re: [open-cobol-list] Error in picture editing
Date: Tue Feb 7 15:54:11 2006
User-agent: KMail/1.8.2

On Tuesday 07 February 2006 06:21 pm, Carsten Reimer wrote:
> Hallo,
> i am totally new to cobol so maybe my problems arise from my complete
> misunderstanding of some basic cobol concepts. If this is the case I
> would like to appologize in advance for asking stupid questions.
> I try to follow an online-tutorial and I got stuck when it comes to
> editing pictures. Following is my example programme:
>        PROGRAM-ID.
>            uebung1.
>        AUTHOR.
>            creimer.
>            FH? NON!  D-21339 LUENEBURG.
>        DATE-WRITTEN.
>            Tue Feb  7 22:12:12 2006.
>       ******************************************************************
>        FILE-CONTROL.
>       ******************************************************************
>        FILE SECTION.
>       ******************************************************************
>        01  ue1b              PIC 999V99 VALUE 02345.
>        01  ue1bget           PIC 999.9.
>       ******************************************************************
>            MOVE ue1b TO ue1bget.
>            DISPLAY ue1bget.
>            STOP RUN.
>       *
> With respect to the tutorial this should result in printing 023.4 on the
> screen which sounds logical to me because ueb1b has two digits after the
> decimal pint whereas ueb1bget is only allowed to have one and the
> leading zero should be kept. When I compile and run this programme with
> OpenCobol 0.32 compiled with no errors on an up to date ubuntu linux box
> it results in printing 345.0 to the screen.
> If members of the list may verify that this result definitely is wrong
> maybe someone might have some suggestions how to correct or debug the
> beviour of OpenCobol because I would like to use it for the tutorial.
> Thanks in advance
> with best regards
> Carsten Reimer
COBOL is very literal. When you said the numeric value was 345
(three hundred forty five) that is exactly what it put into the
field. The leading zero is meaningless and is ignored. 345 0345
and 00345 all have the same numeric value.  

If houwever you had said   
        01  ue1b              PIC 999V99 VALUE 023.45. would have gotten the result you expected. The leading
zero is still superfluous however.


John Culleton

John Culleton
Books with answers to marketing and publishing questions:

Book coaches, consultants and packagers:

reply via email to

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