HOME  NEWS  FORUM  DOWNLOAD  LINK
OpenCOBOL - an open-source COBOL compiler
Main Menu
Download
Documentation
Development
Who's Online
19 user(s) are online (10 user(s) are browsing Forum)

Members: 0
Guests: 19

more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     Moving values to packed numerics defined with decimals
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
LeBoepp
Posted on: 2008/4/17 18:14
Just popping in
Joined: 2008/4/17
From: Stuttgart, Germany
Posts: 6
Moving values to packed numerics defined with decimals
Hello,

we're migrating from MicroFocus to OpenCobol at the moment.
Seems like we've discovered the following problem.

Example program:

WORKING-STORAGE SECTION.

	01    W-FIELDS.
         05   W-TEST1              PIC S9(06)V9(06) COMP-3 VALUE ZERO.
         05   W-TEST2              PIC S9(06)V9(06)        VALUE ZERO.
         05   W-TEST3              PIC S9(06)       COMP-3 VALUE ZERO.
         05   W-TEST4              PIC S9(06)              VALUE ZERO.
         05   W-TEST5              PIC  9(06)       COMP-3 VALUE ZERO.
         05   W-TEST6              PIC  9(06)              VALUE ZERO.
         05   W-TEST7              PIC  9(06)V9(06) COMP-3 VALUE ZERO.
         05   W-TEST8              PIC  9(06)V9(06)        VALUE ZERO.

PROCEDURE DIVISION.

           MOVE 999999   TO W-TEST1.
           MOVE 999999   TO W-TEST2.
           MOVE 999999   TO W-TEST3.
           MOVE 999999   TO W-TEST4.
           MOVE 999999   TO W-TEST5.
           MOVE 999999   TO W-TEST6.
           MOVE 999999   TO W-TEST7.
           MOVE 999999   TO W-TEST8.

           DISPLAY 'W-TEST1 [' W-TEST1 ']'.
           DISPLAY 'W-TEST2 [' W-TEST2 ']'.
           DISPLAY 'W-TEST3 [' W-TEST3 ']'.
           DISPLAY 'W-TEST4 [' W-TEST4 ']'.
           DISPLAY 'W-TEST5 [' W-TEST5 ']'.
           DISPLAY 'W-TEST6 [' W-TEST6 ']'.
           DISPLAY 'W-TEST7 [' W-TEST7 ']'.
           DISPLAY 'W-TEST8 [' W-TEST8 ']'.

           MOVE 999999,0   TO W-TEST1.
           MOVE 999999,0   TO W-TEST7.
           
           DISPLAY 'W-TEST1 2nd time [' W-TEST1 ']'.
           DISPLAY 'W-TEST7 2nd time [' W-TEST7 ']'.


Output:

W-TEST1 [000728379968-] <-- what happened here?
W-TEST2 [999999000000+]
W-TEST3 [999999+]
W-TEST4 [999999+]
W-TEST5 [999999]
W-TEST6 [999999]
W-TEST7 [000728379968] <-- what happened here?
W-TEST8 [999999000000]
W-TEST1 2nd time [999999000000+] <-- now it's ok
W-TEST7 2nd time [999999000000] <-- now it's ok


Expected Output:

W-TEST1 [999999000000+]
W-TEST2 [999999000000+]
W-TEST3 [999999+]
W-TEST4 [999999+]
W-TEST5 [999999]
W-TEST6 [999999]
W-TEST7 [999999000000]
W-TEST8 [999999000000]
W-TEST1 2nd time [999999000000+]
W-TEST7 2nd time [999999000000]



cobc (OpenCOBOL) 1.0.0
using the -std=mf flag

HP-UX machinename B.11.31 U ia64 3567537583 unlimited-user license



Thanks for help...
LeBoepp
Bear
Posted on: 2008/4/17 18:39
Home away from home
Joined: 2006/12/12
From: FRANCE
Posts: 166
Re: Moving values to packed numerics defined with decimals
Can you try with OC 1.1.0 ?

LeBoepp
Posted on: 2008/4/18 9:42
Just popping in
Joined: 2008/4/17
From: Stuttgart, Germany
Posts: 6
Re: Moving values to packed numerics defined with decimals
We are now going to install OC 1.1.0 pre-release.
I'll inform you on the results.

Alternatively, we'll have to change all our sources.

Thanks!
simrw
Posted on: 2008/4/18 10:43
Webmaster
Joined: 2005/5/31
From: Bad Soden, Germany
Posts: 776
Re: Moving values to packed numerics defined with decimals
Yep, bug in OC.
I have just put a preliminary fix into the
code and updated the 1.1 tarball.
If you have downloaded prior to the date/time of
this post, then please redownload.

Roger
LeBoepp
Posted on: 2008/4/18 11:55
Just popping in
Joined: 2008/4/17
From: Stuttgart, Germany
Posts: 6
Re: Moving values to packed numerics defined with decimals
It works!

Output looks like expected now:

W-TEST1 [999999000000+]
W-TEST2 [999999000000+]
W-TEST3 [999999+]
W-TEST4 [999999+]
W-TEST5 [999999]
W-TEST6 [999999]
W-TEST7 [999999000000]
W-TEST8 [999999000000]
W-TEST1 2nd time [999999000000+]
W-TEST7 2nd time [999999000000]


Thanks a lot!
LeBoepp
human
Posted on: 2008/4/20 6:41
Home away from home
Joined: 2007/5/15
From:
Posts: 967
Re: Moving values to packed numerics defined with decimals
Hm... there is no entry for that in cobc/ChangeLog
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 
Copyright (C) 2005 The OpenCOBOL Project. All rights reserved.
Powered by Xoops2 | PHP | MySQL | Apache
ocean-net