View previous topic :: View next topic
|
Author |
Message |
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Naveen,
As was asked in my earlier post,please post your copybook |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
and the db2 table definition |
|
Back to top |
|
|
valishaik
New User
Joined: 26 Sep 2007 Posts: 1 Location: Hyderabad
|
|
|
|
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 |
|
|
advith001
New User
Joined: 16 Mar 2005 Posts: 23
|
|
|
|
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.
Anna. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Use char columns for character data and numeric columns for numeric data! |
|
Back to top |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
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 |
|
|
advith001
New User
Joined: 16 Mar 2005 Posts: 23
|
|
|
|
If you don't mind.. can you pls post the code what you did?-Anna |
|
Back to top |
|
|
|