View previous topic :: View next topic
|
Author |
Message |
jpraveenreddy
New User
Joined: 30 Nov 2007 Posts: 28 Location: mysore
|
|
|
|
Hi friends,
I want to find length of a field and pad zeroes,but I am not sure whether to do it using INSPECT verd or with intrinsic FUNCTION LENGTH.
Can you tell me the difference between the two approaches? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
function length will return the PIC clause defined length.
one of the inspect formats will tally the number of instances a char exists in a field.
I don't understand: I want to find length of a field and pad zeroes. |
|
Back to top |
|
|
jpraveenreddy
New User
Joined: 30 Nov 2007 Posts: 28 Location: mysore
|
|
|
|
Thanx dbzTHEdinosauer.
Thats what I was thinking, now its confirmed.
I wanted to pad zeroes in the unoccupied positions of the field. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
jpraveenreddy wrote: |
I wanted to pad zeroes in the unoccupied positions of the field. |
If you know what is in the 'unoccupied' positions, INSPECT REPLACING will work fine. Have you looked at NUMVAL and NUMVAL-C? |
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
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. |
|
Back to top |
|
|
|