Answered Obtaining default codepage

Chris Hughes

ProgressTalk.com Sponsor
This may be more relevant on the developer forum but this is a database admin task so I'm gonna ask here first :)

I'm scripting the dump and load of databases as much as I can, I'm going to run something like this to dump out the definitions

RUN prodict/dump_df.p (INPUT "ALL",
INPUT ".\dump\mydb.df",
INPUT "ISO8859-1").
QUIT.

Thing is I don't want to hard code the code page, so question is how do I get the code page that the GUI automatically populates for us?

pro1.png


Thanks
 

Chris Hughes

ProgressTalk.com Sponsor
Thanks.

I think you had a slight typo - SESSION:CPINTERNAL - I knew what you meant ;)

Both give me the same result so I'm going with DBCODEPAGE(dbname) for now.
 

Stefan

Well-Known Member
From %DLC%\src\prodict\user\_usrdump.p:

Code:
/* Set default value for codepage gfs:94-04-28-043 */
IF user_env[5] = "" OR user_env[5] = ? THEN DO:
  IF SESSION:CHARSET = "UNDEFINED" THEN 
  DO:
    FIND FIRST _db NO-LOCK.
    ASSIGN user_env[5]  = _db._db-xl-name. /* db codepage */
  END.
  ELSE IF SESSION:STREAM  = "UNDEFINED" THEN
    ASSIGN user_env[5]  = SESSION:CHARSET.
  ELSE ASSIGN user_env[5] = SESSION:STREAM.
  ASSIGN user_env[5]:SENSITIVE = true.
END.

So I would think that in most cases it will default to SESSION:STREAM.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
prodict/dump_df.p does the same thing: if the third parameter is "" then it is set to SESSION:STREAM.

Code:
Input-Parameters:
  file-name  : "ALL" or "<file-name> [,<filename>] ..."
  df-file-name  : Name of file to dump to
  code-page  : ?, "", "<code-page>"

Code-page - support:
  code-page = ?  : no-conversion
  code-page = ""  : default conversion (SESSION:STREAM)
  code-page = "<code-page>" : convert to <code-page>

  if not convertable to code-page try to convert to SESSION:STREAM
  if still not convertable don't convert at all
 
Top