Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Display value 12345 as 1.2345

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Wed Jun 01, 2011 3:52 pm    Post subject: Display value 12345 as 1.2345
Reply with quote

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
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Jun 01, 2011 4:04 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Vidya Kajale

New User


Joined: 01 Jun 2010
Posts: 43
Location: India

PostPosted: Wed Jun 01, 2011 4:17 pm    Post subject:
Reply with quote

thank u i got it.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Jun 01, 2011 4:26 pm    Post subject:
Reply with quote

Bitte sehr
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Wed Jun 01, 2011 5:02 pm    Post subject:
Reply with quote

You can also divide the value by 10000
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Jun 01, 2011 5:37 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts display the sign only if the value is... useit DFSORT/ICETOOL 3 Wed Oct 04, 2017 5:53 pm
No new posts Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts Display upon console bipinpeter COBOL Programming 1 Thu Jun 22, 2017 12:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us