IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Difference between INSPECT and FUNCTION LENGTH


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jpraveenreddy

New User


Joined: 30 Nov 2007
Posts: 28
Location: mysore

PostPosted: Thu Feb 21, 2008 1:07 pm
Reply with quote

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? icon_smile.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Feb 21, 2008 1:31 pm
Reply with quote

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

New User


Joined: 30 Nov 2007
Posts: 28
Location: mysore

PostPosted: Thu Feb 21, 2008 2:11 pm
Reply with quote

Thanx dbzTHEdinosauer.
Thats what I was thinking, now its confirmed.
I wanted to pad zeroes in the unoccupied positions of the field. icon_biggrin.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Feb 21, 2008 8:09 pm
Reply with quote

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

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Fri Feb 22, 2008 10:42 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
Search our Forums:

Back to Top