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
 
Can zoned decimal in varchar be converted to a diff format?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
bmwibm

New User


Joined: 24 Apr 2008
Posts: 5
Location: Express Scripts

PostPosted: Mon Nov 17, 2008 7:00 pm    Post subject: Can zoned decimal in varchar be converted to a diff format?
Reply with quote

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
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Nov 17, 2008 9:51 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Nov 18, 2008 4:20 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Format Last Record differently from r... Learncoholic DFSORT/ICETOOL 5 Tue Oct 24, 2017 12:01 pm
No new posts Format issues using XMITIP MSGDD ssdjp1 CLIST & REXX 5 Mon Oct 23, 2017 8:47 pm
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm

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