View previous topic :: View next topic
|
Author |
Message |
Vidya Kajale
New User
Joined: 01 Jun 2010 Posts: 43 Location: India
|
|
|
|
Hi!
I want to display value 12345 as 1.2345 using cobol program. How shall i do it?
I tried it with various options as one is given below but still its not working. Please suggest me suitable way.
WORKING-STORAGE SECTION.
01 WS-A PIC 9(5).
01 WS-B PIC X(5).
01 WS-C PIC Z.Z(4).
PROCEDURE DIVISION.
DISPLAY 'START OF PROGRAM'.
MOVE 12345 TO WS-A.
MOVE WS-A TO WS-B.
MOVE WS-B TO WS-C.
DISPLAY 'WS-C :' WS-C
STOP RUN.
In Sysout i got as:
START OF PROGRAM
WS-C :5.0000. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Code: |
working-storage section.
01 workareas.
05 ws-a pic 9(5).
05 ws-b
redefines
ws-a pic 9v9(4).
05 ws-c pic z.z(4).
procedure division.
DISPLAY 'START OF PROGRAM'.
MOVE 12345 TO WS-A.
MOVE WS-B TO WS-C.
DISPLAY 'WS-C :' WS-C
STOP RUN.
|
|
|
Back to top |
|
|
Vidya Kajale
New User
Joined: 01 Jun 2010 Posts: 43 Location: India
|
|
|
|
thank u i got it. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Bitte sehr |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
You can also divide the value by 10000 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
gylbharat wrote: |
You can also divide the value by 10000 |
Yes, but why would you when Dick has the neatest and most obvious possible - plus efficient with CPU. |
|
Back to top |
|
|
|