• 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?

#1
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?
 

Cringer

ProgressTalk.com Moderator
Staff member
#2
Code:
DEFINE VARIABLE lv-char AS CHARACTER NO-UNDO.
DEFINE VARIABLE lv-i AS INTEGER NO-UNDO.
MyBlock:
DO lv-i = 1 to 100000:
  ASSIGN lv-char = lv-char + "a" NO-ERROR.
  IF ERROR-STATUS:ERROR THEN
  DO:
    MESSAGE lv-i VIEW-AS ALERT-BOX.
    LEAVE MyBlock.
  END.
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.
 

tamhas

ProgressTalk.com Sponsor
#4
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
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?
 

RealHeavyDude

Well-Known Member
#7
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.