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
 

 

Extracting the numeric data from Alpha Numeric Field

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

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Mar 17, 2008 10:08 am    Post subject: Extracting the numeric data from Alpha Numeric Field
Reply with quote

Can anyone help me on this.

My Requirement is

I should fetch the column(Interest Rate) of DB2 table which is in AlphaNumeric Format (& its field length is 40) then i should use those values for the calculation.

Scenario

Interest Rate -----------> DB2 Table
24 ------------> 4 cases
23.5 ------------> which is in alphanumeric format
17.87 ------------> Field Length is 40
34.8776

I have done some logic for the conversion of alphanumeric to numeric and got the output like

24000000 After the conversion, i have mapped these values in
23.50000 FILE-AID it maps exactly for the numeric
17.87000
34.87760

But when i using this values for the calculation say (2400000 + 1000) and just displaying the output im getting SOC7 Abend, means im moving the junk values to the variable.

Can anyone throw a light on this!!!!!!
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Mar 17, 2008 10:15 am    Post subject:
Reply with quote

Naveen,

By looking at your examples, I believe the o/p is not a numeric one. Revisit your logic.

And also post your layout
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Mar 17, 2008 10:21 am    Post subject:
Reply with quote

Murali,

Thanks for your input!!!!

But when i map the fields with the copybook it maps exactly for the numeric!!!!!

Db2 table field length

012345.......40
24
23.4
34.56
56.7865 The Remaining places are occupied by spaces
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Mar 17, 2008 11:42 am    Post subject:
Reply with quote

Naveen,

As was asked in my earlier post,please post your copybook
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Mon Mar 17, 2008 1:04 pm    Post subject: Reply to: Extracting the numeric data from Alpha Numeric Fie
Reply with quote

and the db2 table definition icon_smile.gif
Back to top
View user's profile Send private message
valishaik

New User


Joined: 26 Sep 2007
Posts: 1
Location: Hyderabad

PostPosted: Mon Mar 17, 2008 2:26 pm    Post subject:
Reply with quote

Naveen,

I thinks in the DB2 this column is defined as CHAR and you are getting SOC7 abend due to improoer movement values to the numeric field.
Write a simple logic to get only the non numeric values from the CHAR field ( DB2 col) and use Referrece modification logic to move exact number field.

ex:

01 WS-NUM-FIELD 9(2)V9(5) VALUE ZERO.


INSPECT ws-db2-col-name TALLYING WS-TALLY1
FOR CHARACTERS BEFORE ' '.


MOVE WS-DB2-COL-NAME(1:WS-TALLY1) to WS-NUM-FIELD

Hope this will workout..

-----------
Regards,
V A L I
Back to top
View user's profile Send private message
advith001

New User


Joined: 16 Mar 2005
Posts: 23

PostPosted: Mon Mar 17, 2008 4:11 pm    Post subject:
Reply with quote

Naveen,
cannt you use redefines in this case? just an idea!

Store your fetched data of 40 alphanumeric and redefine it with the record layout as you required. icon_smile.gif


Anna.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Mon Mar 17, 2008 5:35 pm    Post subject:
Reply with quote

Use char columns for character data and numeric columns for numeric data!
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Tue Mar 18, 2008 9:09 am    Post subject: Reply to: Extracting the numeric data from Alpha Numeric Fie
Reply with quote

Thanks a lot dudes!!!!!!!!! 4 de replies


Actually, my previous logic was

I have used the INSPECT statement to get the counter of total length, then i will extract it using the reference modification, then im moving the extracted values to the re-defined variable then im moving that numeric value to the assume decimal point....after all these when im displaying these values and mapping with the copybook it is giving the exact value, but only it get abend when i use that for calculation.

copybook

01-inp-file
05 cust-data pic 9(10)
Back to top
View user's profile Send private message
advith001

New User


Joined: 16 Mar 2005
Posts: 23

PostPosted: Tue Mar 18, 2008 1:16 pm    Post subject:
Reply with quote

If you don't mind.. can you pls post the code what you did?-Anna
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 Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm


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