Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 6967
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: 6967
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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Display ZEDLMSG without Pressing F1 &... anandgbe CLIST & REXX 8 Thu Dec 15, 2016 4:20 pm
No new posts How to display value of an exit param... lind sh CICS 2 Sun Oct 09, 2016 12:28 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us