Problem with trimming the filed value
Moderators: chulett, rschirm, roy
Problem with trimming the filed value
Hi All,
Well i have an issue here with the trim function.
i have this filed which looks like this 000000000205935. This field is actually the record count fo the file and it is of length 15 . well now i want to get only the actualy record count as in i need to get rid of the zero's which are at the first . well this can be done by doin the usual trim and left function but i need something in general as the record count may vary . that i need the function to pick the actual count after neglecting all zeros ahead of it .
could someone help me with this?
Well i have an issue here with the trim function.
i have this filed which looks like this 000000000205935. This field is actually the record count fo the file and it is of length 15 . well now i want to get only the actualy record count as in i need to get rid of the zero's which are at the first . well this can be done by doin the usual trim and left function but i need something in general as the record count may vary . that i need the function to pick the actual count after neglecting all zeros ahead of it .
could someone help me with this?
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
If I understood it right. Trim will achieve what your are looking for.
Code: Select all
Trim(In.Column, "0", "L")
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Another option
Code: Select all
fmt(In.Column, "Z")
Narasimha Kade
Finding answers is simple, all you need to do is come up with the correct questions.
Finding answers is simple, all you need to do is come up with the correct questions.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Of all the answers given, adding zero requires the fewest CPU cycles and is therefore the most efficient.
Both arithmetic solutions (add zero, multiply by one) rely on the fact that DataStage BASIC always returns the shortest possible character string as its arithmetic result - leading and trailing redundant zeroes are removed.
Both arithmetic solutions (add zero, multiply by one) rely on the fact that DataStage BASIC always returns the shortest possible character string as its arithmetic result - leading and trailing redundant zeroes are removed.
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.
-
- Participant
- Posts: 232
- Joined: Fri Sep 30, 2005 4:52 am
- Contact: