Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Signed numbers in Fujitsu Compiler Version V30L10 ? 1

Status
Not open for further replies.

mikrom

Programmer
Mar 27, 2002
3,001
SK
I´m new in COBOL, try to use the free Fujitsu Compiler Version V30L10, but I still have some problems with signed numerical datatypes.
It seems to be a bug of this compiler version.

1. On the declaration

77 VAR-1 PIC S9999.
77 DSPVAR PIC -ZZZZ9.

produce the statements

MOVE -123 TO VAR-1.
MOVE VAR-1 TO DSPVAR.

the compiler warning:
JMN3326I-W 'VAR-1' IS UNSIGNED NUMERIC ITEM OR NUMERIC EDITED ITEM WITHOUT EDITING SIGN CONTROL SYMBOLS IN MOVE STATEMENT. NEGATIVE VALUE CANNOT BE MOVED.
The variable DSPVAR obtains the value 120.

2. The declaration

77 VAR-1 PIC S9999 BINARY.
77 VAR-2 PIC S9999 BINARY.
77 VAR-3 PIC S99999 BINARY.

and the following statement

COMPUTE VAR-3 = VAR-1 + VAR-2

result in the error messages:
JMN2012I-S BINARY,COMPUTATIONAL,COMPUTATIONAL-3 OR PACKED-DECIMAL MUST BE SPECIFIED FOR NUMERIC ITEM.
JMN3151I-S OPERAND 'VAR-1' IN ARITHMETIC EXPRESSION MUST BE NUMERIC ITEM.
JMN3151I-S OPERAND 'VAR-2' IN ARITHMETIC EXPRESSION MUST BE NUMERIC ITEM.

I tried the datatypes COMP, COMP-3 etc too.

According to the delivered WINSVD debugger, the compiler handle the datatypes at the following way:
PIC 9999 External Decimal
PIC -Z9999 Numeric Edited.
PIC S9999 Numeric Edited (WHY ??!),
The declaration of PIC S9999 BINARY (or COMP resp. COMP-3) is generally not possible.

Is there any secret compiler option to work with signed numbers?
Has anybody some experiences with solving this problem,
or is this the serious bug of Fujitsu Compiler Ver.3 ?
 
I tried your first example with my PowerCobol v.6.1 and it worked well so it is probably a bug in your old version.
Only a suggestion :
It's a bit strange to use -ZZZZ9.; It's not better to use -----9. ?
I can't help more because I have not your compiler version; sorry.
 
Also new to Fujitsu, where did you get the compiler.

You might check where the sign position is, leading or trailing. Also I read your error as in the move statement and not the declaration. You may find that you're moving a leading sign into a trailing sign field and automatic conversion is not supported.

 
Thank you for suggestions.
First I tried instead of -ZZZZ9 to declare -----9.
The next declaration of
PIC S9999 SIGN IS LEADING or PIC S9999 SIGN IS TRAILING
caused the error message
JMN2013I-S SIGN CLAUSE CANNOT BE SPECIFIED FOR ELEMENTARY ITEM EXCEPT SIGNED EXTERNAL DECIMAL ITEM.

The COMPUTE statement with so declared variables causes the error message
JMN3151I-S OPERAND 'VAR-1' IN ARITHMETIC EXPRESSION MUST BE NUMERIC ITEM.
.. etc

I thing the problem is that the compiler ignores the S as sign and treats the S9999 variables as nonumeric (the debugger shows they as Numeric Edited). Therefore it cannot perform computation with numeric edited variables as operands.

I downloaded this free Fujitsu COBOL Version 3 Starter Set from
The file's name is cobolv3.exe (12020952 Bytes).
I tried the compiler on Windows NT4 Workstation and Windows 95 but it does the same errors on both systems.

Is there any other free Fujitsu (or from other manufacturer) compiler version for PC ?
 
You can check if it is a parsing bug.
Try the following declarations and see wheter they work :

77 VAR-1 PIC S9(04) COMP-5.
77 VAR-1 PIC S9(04) COMP-3.
77 VAR-1 COMP-1.
77 VAR-1 COMP-2.
77 VAR-1 PIC S9(04).

If they do not work, try also to substituite the level number 77 with 01; Fujitsu compiler is really
strange sometimes.
 
Thank You very much Erba for Your great help!

The Fujitsu compiler Version 3 has some incompatibilities with other COBOL Compilers (or bugs), but it can be useful.

My little problem is now solved. It works with declaration

77 (or 01) VAR-1 COMP-1 (or COMP-2).

The other declarations
77 (or 01) VAR-1 PIC S9(04) COMP-5.
or
77 (or 01) VAR-1 PIC S9(04) COMP-3.
cause error messages.

Now I know (from User's Guide) that COMP-1 resp. COMP-2 are single resp. double precision internal floating point numbers, but I don't understand what is the meaning of COMP-3 and COMP-5. Are COMP-1, COMP-2 .. etc the same data types in all COBOL compilers?

 
In the past I used RM compiler so I can talk only about it.

In RM COMP-1 is 2 bytes log and COMP-2 is 4 bytes long and they want a PIC declarations.
Fujitsu's COMP-1 is 4 bytes long and COMP-2 is 8 bytes long and won't a PIC declaration (You'll get an error if you do it).

COMP-3 behave exactly the same for both compilers. Its lenght is (number_of_digit / 2 + half byte for the sign) rounded up.

COMP-5 behave differently on Intel platform because of its bytes swapping (Little Endian format). Its lenght is :
1 to 4 digits : 2 bytes
5 to 9 digits : 4 bytes
10 to 18 digits: 8 bytes

RM's compiler have also a COMP-4 format that I have not yet seen on Fujitsu's.

It is really a pity that version 3 have a so BIG bug because it make it practically useless.
Maybe it is a possible installation or download problem : try to write to support@adtools.com. Normally they do not provide support for version 3, but in this case it is possible they do.

Check also if the same declarations, but with decimal point, work :
77 VAR-1 PIC S9(04)V9(02) COMP-5.
77 VAR-1 PIC S9(04)V9(02) COMP-3.
77 VAR-1 PIC S9(04)V9(02).

Pay also attention not to use COMP- data format as a file's key : they are not ordered properly (ASCII ordering instead of numer ordering).
Other compilers do not have this last problem (RM at least had surely not).

Hi
 
Thank you for the explanation of COMP-n datatatypes. In the meantime I downloaded from internet the very old IBM Cobol/2 Compiler for DOS (Version 1). It works good with our Fujitsu-problematic declaration but it seems don't know COMP-1 and COMP-2 with or without PIC clause.

I tried the declaration
77 VAR-1 PIC S9(04)V9(02).
Moving negative value in VAR-1 causes the message
JMN3326I-W 'VAR-1' IS UNSIGNED NUMERIC ITEM OR NUMERIC EDITED ITEM WITHOUT EDITING SIGN CONTROL SYMBOLS IN MOVE STATEMENT. NEGATIVE VALUE CANNOT BE MOVED.

The other both declarations
77 VAR-1 PIC S9(04)V9(02) COMP-5.
77 VAR-1 PIC S9(04)V9(02) COMP-3.
causes the message
JMN2012I-S BINARY,COMPUTATIONAL,COMPUTATIONAL-3 OR PACKED-DECIMAL MUST BE SPECIFIED FOR NUMERIC ITEM.

I downloaded the Fujitsu Version 3 compiler to learn COBOL and trying some COBOL-examples at home. It has very friendly and simple user interface. But now after finding this bug I'm a little bit confused, because it's very possible that there are other serious bugs. I tried to compile some delivered samples too, but they don't work because of the problem with signed numbers.

I will write to Fujitsu support and ask them about this problem.


 
Each product I bought had bugs, version 6 too. And I am talking about products costing around $3000 to $5000.
As in my experience, programming is just surfing around bugs. Workaround will be your most used word. The last bug I found was a PRO*COBOL precompiler bugs (from Oracle) : it want not work at all; the solution suggested by Oracle was : put the PC's system date before sept 09 2001! that's incredible; I had the lucky to find a better workaround.
So do not be frustated : wait for Fujitsu's reply.
Fujitsu version 6 is one of the better cobol I know.
Hi
 
Hi,
I obtained the Fujitsu's support reply. They only tested all cases with COBOL V6. Neither produced compile error. They told me, that the solution is to upgrade to higher version of COBOL. I should purchase COBOL V6 and product maintenance which will entitle me to their support.

:)

 
If you are only mastering cobol, Verison 6 may be too expensive for you (but I do not know your situation).
But you can buy the professional edition with 1 year support for only 250$ as a student. If you can spend that money, it will be an excellent solution.
If you think to buy, it is better you wait until next month when version 7 will be released (very probably).

About version 3:
It was developped for win3.1, win95, win98 and winNT; so if you are using it with win2k or winXp, you may experience unexepected problems. In this case you can always try it on an old PC and see what happen.
 
Hallo Erba,

Thank you for all information about Fujitsu COBOL and for your help with my problem. To buy the compiler for the home usage for such a price is very expensive for me.
My situaution concerning COBOL is following: Since january I have a good job at a financial institution. One of my tasks is to maintain existing and develop new ILE COBOL applications on AS/400. To do this I used the APS case system. Now I´m trying to write interactive application directly in ILE COBOL. Because I never programmed in COBOL before, I need to learn it. Therefore I downloaded this free version of Fujitsu Compiler. I´m searching only for the free (or very cheap), but good COBOL 85 compiler for the studying at home. Do you have some tips?
 
The only way, in my opinion, to learn a language, is watching to professional programs developed by skilled programmers. And you have this opportunity : so be happy.
15 years ago, I learned cobol in exactly the same way. There is no book nor manual that can give you a so big amount of experience than good programs.
Also I never wanted a PC at home : at home let your brain work (or pause), not the PC. You'll get better results.
At work try to start some little projects not mixed with other and crucial programs, and experiment with them.
The better thing is always learn with the same compiler that you need work to (surely your company have all the documentation you need and, maybe, support too).
All cobol compilers do the same things, but each compiler have a different flavor, and you will always get a bit confused passing from one compiler to another.
But if you feel that in a future your company will need a GUI interface, so ask them to buy fujitsu's or merant's products and experiment with them. If you want do professional work, than you need professional tools.

bye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top