View previous topic :: View next topic
|
Author |
Message |
bmwibm
New User
Joined: 24 Apr 2008 Posts: 5 Location: Express Scripts
|
|
|
|
How can zoned decimal data in a varchar column be converted to integer or packed decimal?
VARCHAR column = '00007100A'
desired output = 71001
When I try:
INTEGER(CHAR(SUBSTR(DATA_AREA_DS,1,9))) or
CAST(CHAR(SUBSTR(DATA_AREA_DS,1,9)) AS INTEGER)
I get:
DSNT408I SQLCODE = -420, ERROR: THE VALUE OF A STRING ARGUMENT WAS NOT
ACCEPTABLE TO THE INTEGER FUNCTION |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Just for sanity's sake, i suggest you change the column definiton from varchar or change the value to not include the sign. . . |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
I've seen this same type of problem crop up when someone defines a DB2 field as character and then stores dates there. Why not use DATE field type?? |
|
Back to top |
|
|
|