conversion of float variable to string.



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

conversion of float variable to string.

Postby isai_22 » Fri Jul 30, 2010 10:57 am

Can someone help me out in finding the logic to move a variable of data type 9(2)v9(4) to x(10). I'm moving because I have do string manipulations with that.
isai_22
 
Posts: 5
Joined: Mon Jul 26, 2010 8:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: conversion of float variable to string.

Postby Robert Sample » Fri Jul 30, 2010 2:41 pm

Why not the MOVE statement?

What have you tried and not gotten working?
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: conversion of float variable to string.

Postby dick scherrer » Sat Jul 31, 2010 9:44 am

Hello and welcome to the forum,

As COBOL does not support "string"s, how do you need to manipulate one?

Also, 9(2)v9(4) is not the same length as x(10), so what should happen?

If you show some sample "input" and the "output" you want from the sample input, someone may have a suggestion.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: conversion of float variable to string.

Postby salltm » Wed Aug 04, 2010 1:20 pm

A {9(2)v9(4)} to B {x(10)}.

if you need keep the dot. (.), i guess you want to display / show the value on screen. right?
a temp varaible is needed. C Z9.9(4)

  MOVE SPACES TO B
  MOVE  A to C
  MOVE C TO B. 


hope it works. ;)
salltm
 
Posts: 4
Joined: Fri Dec 05, 2008 8:40 am
Location: China
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post