IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Output error when using COMP


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vrakeshmbt

New User


Joined: 17 Aug 2005
Posts: 30

PostPosted: Sat Dec 10, 2005 12:33 pm
Reply with quote

WORKING-STORAGE SECTION.

01 A PIC 9(4)V9(4).
01 B PIC 9(4)V9(4) COMP.
01 C PIC 9(3)V9(3) COMP.
01 D PIC 9(1)V999 COMP.
01 E PIC 9(3)V99 COMP.

PROCEDURE DIVISION.

MOVE 1234.5678 TO A,B,C,D,E
DISPLAY 'A= ',A.
DISPLAY 'B= ',B.
DISPLAY 'C= ',C.
DISPLAY 'D= ',D.
DISPLAY 'E= ',E.
STOP RUN.


Above shown is the program i have coded, but the value for D is showing wrong in the output.

The output is as follows

A= 12345678
B= 12345678
C= 234567
D= 4919
E= 23456

What would be the reason for this?
Can anyone please explain me.....?
Back to top
View user's profile Send private message
sbalajibe

New User


Joined: 15 Aug 2005
Posts: 62

PostPosted: Sat Dec 10, 2005 2:12 pm
Reply with quote

Initialze all the variables and check it again
it should not happen

thanks
balaji
Back to top
View user's profile Send private message
vrakeshmbt

New User


Joined: 17 Aug 2005
Posts: 30

PostPosted: Sat Dec 10, 2005 3:31 pm
Reply with quote

I have tried using the INITIALIZE variable also again i got the same.
I have tried using some other combinations on D as shown below...

4919 9V9(3) COMP.
919 V9(3) COMP.
7920 99V99 COMP.
4910 V9(4) COMP.
20 V99 COMP.
920 9V99 COMP.

The left side value shows the output for the corresponding right side declaration.

Any way thanks a lot balaji for ur reply
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
Search our Forums:

Back to Top