What is the difference between INSPECT and FUNCTION LENGTH?
-
- New Member
- Posts: 6
- Joined: Wed Jun 11, 2014 8:29 am
What is the difference between INSPECT and FUNCTION LENGTH?
Hi,
I want to find length of a field. Once I know that I'll pad zeroes. But I am not sure if I should this using INSPECT or with intrinsic FUNCTION LENGTH. What is the difference between the two approaches, I'm confused?
I want to find length of a field. Once I know that I'll pad zeroes. But I am not sure if I should this using INSPECT or with intrinsic FUNCTION LENGTH. What is the difference between the two approaches, I'm confused?
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: What is the difference between INSPECT and FUNCTION LENG
If your variable is in WORKING-STORAGE, the length does not change, ever. So FUNCTION LENGTH will only return one value no matter what data is stored in the variable. INSPECT allows you to locate the last byte of relevant data in the variable.
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: What is the difference between INSPECT and FUNCTION LENG
Can you show an example of what you are trying to do?
-
- New Member
- Posts: 6
- Joined: Wed Jun 11, 2014 8:29 am
Re: What is the difference between INSPECT and FUNCTION LENG
I've a field which migh tcome like this "$$$$$1234" or "$$$$$$234" or "$$$$$$$34" or "$$$$$$$$4" or "$$$$$$$$$", where $ represents a space and it might alos be like "1234$$$$$" etc. I need to replace $ with a zero.
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
-
- Global Moderator
- Posts: 588
- Joined: Wed Nov 20, 2013 11:53 am
- Location: Mars
Re: What is the difference between INSPECT and FUNCTION LENG
Are you sure "1234$$$$$" replacing $ with 0 for this type is correct?
Don't you need any justification?
Don't you need any justification?
zprogrammer
-
- New Member
- Posts: 6
- Joined: Wed Jun 11, 2014 8:29 am
Re: What is the difference between INSPECT and FUNCTION LENG
I'd need justifcation too. I'll try with INSPECT and reference modification.
-
- Global Moderator
- Posts: 588
- Joined: Wed Nov 20, 2013 11:53 am
- Location: Mars
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute