Signed Numeric



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Signed Numeric

Postby mohbaig » Fri Nov 15, 2013 2:16 pm

Declared one variable @ 01 level
01 WS-NUM1 PIC S9(9) VALUE +100.
DISPLAY WS-NUM1.
showing the Result as 00000010{
How to resolve this to show the exact number in display.

Please advice.
mohbaig
 
Posts: 28
Joined: Sun Nov 10, 2013 10:55 pm
Has thanked: 7 times
Been thanked: 0 time

Re: Signed Numeric

Postby BillyBoyo » Fri Nov 15, 2013 2:53 pm

MOVE WS-NUM1 to a numeric-edited field with a sign. Like PIC -(8)9 or PIC Z(8)9-- or something of your choice. The manual describes editing well.

Then DISPLAY your new field.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Signed Numeric

Postby mohbaig » Fri Nov 15, 2013 11:35 pm

WORKING-STORAGE SECTION.
01 WS-NUM1 PIC S9(9) VALUE +100.
01 WS-NUM2 PIC -9(9) VALUE ZERO.
PROCEDURE DIVISION.
DISPLAY WS-NUM1. ---->00000010{
MOVE WS-NUM1 TO WS-NUM2.
DISPLAY WS-NUM1. ------->00000010{
STOP RUN.

Still facing the issue.. :(
mohbaig
 
Posts: 28
Joined: Sun Nov 10, 2013 10:55 pm
Has thanked: 7 times
Been thanked: 0 time

Re: Signed Numeric

Postby Akatsukami » Sat Nov 16, 2013 12:05 am

mohbaig wrote:WORKING-STORAGE SECTION.
01 WS-NUM1 PIC S9(9) VALUE +100.
01 WS-NUM2 PIC -9(9) VALUE ZERO.
PROCEDURE DIVISION.
DISPLAY WS-NUM1. ---->00000010{
MOVE WS-NUM1 TO WS-NUM2.
DISPLAY WS-NUM1. ------->00000010{
STOP RUN.

Still facing the issue.. :(
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day

These users thanked the author Akatsukami for the post:
mohbaig (Sat Nov 16, 2013 12:30 am)
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post