Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
arunmozhicholan

New User

Joined: 07 Feb 2007
Posts: 27
Location: chennai

 Posted: Tue May 27, 2008 4:30 pm    Post subject: TO convert X(12) to 9(10)v9(02) i have a value in input file in X(12) pic clause as 0000000005.5f whcih has to be converted to 5.56...how can we convert it to numeric value..can we move it to 9(10)v9(02).is it possible?

Active User

Joined: 31 Aug 2006
Posts: 103
Location: INDIA

 Posted: Tue May 27, 2008 5:06 pm    Post subject: Reply to: TO convert X(12) to 9(10)v9(02) Try NUMVAL Function. It is used to convert Alphanumeric values to Numeric, provided you have Numeric value in your Alphanumeric Variables. Have a look HERE
Craq Giegerich

Senior Member

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

 Posted: Tue May 27, 2008 5:24 pm    Post subject: Redefine your x(13) field as 9(10).9(2) then just do a move.
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Tue May 27, 2008 8:24 pm    Post subject: Arun, You say the field is PIC X(12), but you show "0000000005.5f" (13 pos). Are you sure the value is not "00000000055F", or is the PIC X(13) ? The correct ans depends on correct I/P.
the_gautam

Active User

Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

 Posted: Wed May 28, 2008 9:27 am    Post subject: Using REDEFINES is a good method. However, you have to make sure that the X(12) variable is not having any data that cant be processed as a numeric data in the 9(10)v9(02) variable.
vasanthkumarhb

Active User

Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

Posted: Wed May 28, 2008 10:56 am    Post subject:

Hi,

 the_gautam wrote: Using REDEFINES is a good method. However, you have to make sure that the X(12) variable is not having any data that cant be processed as a numeric data in the 9(10)v9(02) variable.

Is REDEFINES is a perfect convertor from one data type to another data type??. It just reallocates the memory for the new variable.
the_gautam

Active User

Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

 Posted: Wed May 28, 2008 11:22 am    Post subject: I never said that REDEFINES is the perfect converter from one data type to another data type. What i told was for his requirement. I also added that he should be careful about the data.
jckraheja

New User

Joined: 19 May 2008
Posts: 13
Location: Pune

 Posted: Wed May 28, 2008 6:01 pm    Post subject: Reply to: TO convert X(12) to 9(10)v9(02) 05 AlphaField-1 pic x(13) value '0000000005.56' 05 Numeric-fld redefines AlphaField-1 pic 9(11)V9(02) --- if input data doesn't contain any sign COMPUTE Numeric-fld = NUMVAL(AlphaField-1) This might solve yr problem....
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Wed May 28, 2008 6:23 pm    Post subject: Well Arun, while we're waiting for an ans, I'll assume the field VAL has to be 00000000055F, since S9(10).9(02) is an invalid PIC. Given that: MOVE PIC-X-FLD TO NUM-FLD(1:) will work if NUM-FLD = PIC S9(10)V9(02). Redefines is the better approach, if you can use it. Whether you use a move or redefines, test the field for numerics before attempting arith.
dbzTHEdinosauer

Global Moderator

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

 Posted: Wed May 28, 2008 6:28 pm    Post subject: jckraheja, user has indicated that he has a overprint sign. why redefine the x-type with the numeric? why not define a new variable , with sign?
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Thu May 29, 2008 6:02 pm    Post subject: Has arunmozhicholan left the building?
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Can EDCICONV convert EBCDIC to ASCII... natt.sut IBM Tools 3 Fri Nov 17, 2017 8:46 pm Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us