Pad leading zeroes to a smallint field
Moderators: chulett, rschirm, roy
Pad leading zeroes to a smallint field
Hi, is there a way to pad leading zeroes to a smallint field within a prallel job? Target is also smallint. Can have values 01 or 1. We always want a leading zeroes so need to make sure the field is always padded, so the 1 become 01. Thanks for your help.
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
-
- Participant
- Posts: 40
- Joined: Mon May 18, 2009 5:22 am
-
- Participant
- Posts: 40
- Joined: Mon May 18, 2009 5:22 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Integers are stored in binary form. You can not expect leading zeroes to be preserved. Only the value is stored. To display with leading zeroes you must use a string data type.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I might suggest that whomever set the resolution status of this thread to "WORKAROUND" change it to "RESOLVED" since workaraound implies that there is a problem with small int and integers in that they cannot be zero padded.
Converting it to a character and padding that STRING with zero's is the only solution and is not a workaround.
Converting it to a character and padding that STRING with zero's is the only solution and is not a workaround.
Mike Hester
mhester@petra-ps.com
mhester@petra-ps.com