1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Determine Maximum Number of Characters that can be stored in CHARACTER Data Type?

Discussion in 'Development' started by saravanakumar, Mar 16, 2012.

  1. saravanakumar

    saravanakumar New Member

    Hi Team,
    Might be a silly question... How can i determine the maximum number of characters that can be stored in a CHARACTER data type (Variable and DB field of type CHARACTER) as part of Progress 10.1C?

    Sometime back i remember i have seen in some document saying we can store 2000 characters to a CHARACTER variable/db field. But when i tried in my machine am able to store more than 3500 characters, i haven't tried more than that. Not sure the exact number of characters CHARACTER variable/DB field of type CHARACTER can hold?
  3. Cringer

    Cringer ProgressTalk.com Moderator Staff Member

    Code (progress):
    4. MyBlock:
    5. DO lv-i = 1 to 100000:
    6.   ASSIGN lv-char = lv-char + "a" NO-ERROR.
    8.   DO:
    9.     MESSAGE lv-i VIEW-AS ALERT-BOX.
    10.     LEAVE MyBlock.
    11.   END.
    12. END.
    That gives 31992 for me. Which ties in with a limit of 32k I'd have thought... So you can put 31991 chars into the variable.
  4. Rob Fitzpatrick

    Rob Fitzpatrick ProgressTalk.com Sponsor

    You have a limit of 32K for a character field, but you also have a limit of 32K for a record.
  5. tamhas

    tamhas ProgressTalk.com Sponsor

    Point being that context matters. I.e., if a record contains a bunch of other things, the practical limit is less than it would be if that were the only field in the record.

    Note longchar doesn't have this limit.
  6. KrisM

    KrisM Member

    Also this limit in expressed in bytes. With a multi-byte codepage (like UTF-8) this does not always match characters.
  7. saravanakumar

    saravanakumar New Member

    Thanks everyone...

    Hi Kris,
    Can you please give a brief note on;

    With a multi-byte codepage (like UTF-8) this does not always match characters.

    I don't think i understood the above line... Sorry for that. Can you please help me?
  8. RealHeavyDude

    RealHeavyDude Well-Known Member

    A multi-byte codepage like UTF-8 means that there are characters, usually the ones outside the ASCII range, which cannot be stored in a single byte. They need more bytes to be stored. Therefore, depending on the characters contained in your string, you might need more bytes than characters in the string to store it.

    Heavy Regards, RealHeavyDude.
  9. saravanakumar

    saravanakumar New Member

    Yes, this made me understand better. Thanks for your quick reply my friend.

    In my case all the characters falls under ASCII range.

Share This Page