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
 
I would like to convert the value in x(10) into 9(4)v9(3)

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

New User


Joined: 25 Oct 2007
Posts: 19
Location: hyderabad

PostPosted: Tue Jan 15, 2008 2:25 am    Post subject: please dont read the above... come here directly..
Reply with quote

01 SELL-COST PIC X(10)

01 NEW-COST PIC 9(4)V9(3)

guys..

i have CSV file that has sell-cost as a field.

I use unstring delimited by comma command and move the sell cost to SELL-COST. The first record has a value of 14.76. When i unstring into SELL-COST it has '14.76 ' but when i unstring into NEW-COST it has 4.76000

iam amazed to see '.' in a variable defined with pic 9(4)V9(3)

anyways.. my need is to move that 14.76 to NEW-COST and convert it as 0014760

SELL-COST wil have decimal numbers only.. it wont have any alphabets..

what should i do??? if i unstring to SELL-COST and move to NEW-COST then its showing the value '6 0000'

need some solution !!!!!!!
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jan 15, 2008 2:34 am    Post subject:
Reply with quote

CSV files are character files, for decimal fields they may include the decimal character and for negative amounts they may include a negative sign. The position of both the decimal character and the sign may varying depending on the number of significant digits.
Back to top
View user's profile Send private message
muhammad

New User


Joined: 25 Oct 2007
Posts: 19
Location: hyderabad

PostPosted: Tue Jan 15, 2008 2:36 am    Post subject: @ Craq
Reply with quote

so.. no solution for this???
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Tue Jan 15, 2008 4:47 am    Post subject:
Reply with quote

Of course there is a solution. But it looks like you are going to have to do post processing on your own after reading into SELL-COST before moving it into the NEW-COST.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Jan 15, 2008 5:04 am    Post subject:
Reply with quote

Hi Muhammad,

The 1st thing you have to do is analyse your IP and determine the various forms the data can take. As Steve said they may contain minus signs: they may even contain commas (I hope not, because that opens a nasty can of worms).

Keep track of each of the formats and note the details. Once you've done that, you s/b ready to code, then show us the results of the analyses.
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Fri Feb 15, 2008 9:45 pm    Post subject:
Reply with quote

Hi Muhammad,

I think you should use NUMVAL FUNCTION for this. Following is an example for this

Code:
01 SELL-COST PIC X(10).
01 NEW-COST PIC 9(4)V9(3).

      ACCEPT SELL-COST.
      COMPUTE NEW-COST = FUNCTION NUMVAL(SELL-COST).


NUMVAL is an IBM supplied FUNCTION using which we can stip numeric data from an alpha-numeric field. Moreover output will be in form of recieving field.

Hope this will resolve your poblem.

Cheers! icon_smile.gif
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 Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm

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