Difference between %len and %size

Posted on 2005-05-15
Last Modified: 2008-02-26
what is the difference between %len and %size built in function with an example?
Question by:mayankgangrade
    LVL 14

    Accepted Solution

    %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.


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

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

    if it was defined as varying then
    %size = 30

    LVL 26

    Expert Comment


    %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.


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    This is an issue that we can get adding / removing permissions in the vCSA 6.0. We can also have issues searching for users / groups in the AD (using your identify sources). This is how one of the ways to handle this issues and fix it.
    OfficeMate Freezes on login or does not load after login credentials are input.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now