Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Difference between %len and %size

Posted on 2005-05-15
4
Medium Priority
?
2,170 Views
Last Modified: 2008-02-26
what is the difference between %len and %size built in function with an example?
0
Comment
Question by:mayankgangrade
2 Comments
 
LVL 14

Accepted Solution

by:
daveslater earned 200 total points
ID: 14006292
HI
%LEN = The length of the contents of a field - if the field is varying length then this coould be less than the size
%size = The size and is fixed.

Example

Str = stringf fld 30 bytes and Holds 'Hi Dave'

%size = 30
%len=30
%trim(%len)) = 7


if it was defined as varying then
%size = 30
%len=7

Dave
0
 
LVL 27

Expert Comment

by:tliotta
ID: 14030524
mayankgangrade:

%len is concerned with the value of a variable, while %size is concerned with how much memory a variable occupies. You'd use %size in order to calculate offsets in memory. You'd use %len to determine the current number of significant digits or characters.

Note that "blanks" are significant characters in character fields. By using the %trim() builtin, you can get the number of non-blank characters.

Variable-length character fields can show differences between %len() and %size() values -- the %len() varies with the value that is set while the %size() remains unchanged. Packed, integer and binary fields can also show differences. If you take the %size() of a packed variable, it'll usually be a bit more than half of the %len() because the digits are 'packed' into memory.

Tom
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
Exchange administrators are always vigilant about Exchange crashes and disasters that are possible any time. It is quite essential to identify the symptoms of a possible Exchange issue and be prepared with a proper recovery plan. There are multiple…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month21 days, 4 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question