If Binary Load failed. (6255)

In Progress V8 if you ever deleted a table or a field from the schema, binary dump and load (D/L) could fail with the following messages:
Table table-name is number N in dump file and M in schema. (6183)
The number of fields in the schema is N, expected M. (6271)

The Version 9.x binary dump and load process does not experience the problem because the corresponding .DF file contains physical position information (RPOS) that is not available to a Version 8.x .DF file.

See also Progress Knowlege Base # 20192 where the problem explained in details.

The following program is suppose to fix this problem. It is standard PSC program that you can find in $DLC\src\prodict\dump directory. It in running from src\prodict\dump_df.p and it is creating database.df file. Changes were made just in one piece of src\prodict\dump\_dmpsddl.p code, so it will be easy to port to your current version of Progress. See DAL comments in the code. This Progress source code is from 8.1C. Besides _dmpsddl.p you will probably also need _dmpdefs.p, located in the same directory.

Note: when making changes, notice that all progams start with underscore "_". So every time you do the change and compile, you need to exit and restart your entire Progress session to clear out the r-code cache, because dot-r files starting with an underscore are cached as if -q was set for them

/*************************************************************/
/* Copyright (c) 1984-1995 by Progress Software Corporation  */
/*                                                           */
/* All rights reserved.  No part of this program or document */
/* may be  reproduced in  any form  or by  any means without */
/* permission in writing from PROGRESS Software Corporation. */
/*************************************************************/

/* _dmpsddl.p - dump data definitions */

/*
in:  user_env[1]   = containing comma-separated list of filenames in
                     current database, *only* if user_filename = "SOME".
     user_env[2]   = Name of file to dump to.
     user_env[5]   = "" or ""
                     (only for "d"!)   /* hutegger 94/02 */
     user_env[6]   = "no-alert-boxes" or something else
     user_env[9]   = "d" - dump defs 
      	       	     	 - if user selected a specific table: translates into
      	       	     	   "t" for dumpdefs.
      	       	     	 - if user selected ALL: translates into "d","s"
      	       	     	   and "t" for dumpdefs where "d" will output both
      	       	     	   auto connect and collation info.
                     "a" - auto connect 
      	       	     "c" - collation info
                     "s" - sequences.
     user_env[25]  = "AUTO" or ""
     user_filename = "ALL"        all files of a schema
                     "SOME"       some of the files of the first schema
                     "SOME MORE"  some of the files of a following schema
                     "ONE"        one file of the first schema
                     "ONE MORE"   one file of a following schema
                     
When dumping automatically all definitions of all schemas, the .df-file 
should contain only one trailer - at the very   end. Therefor the batch-
program passes "AUTO" to suppress the trailer for the 1. to 
n-1. db.
"" symbolizes the default-behaviour (:= generate trailer).

History:
    hutegger    95/01/24    single-files in multiple schemas
    hutegger    94/06/09    batch-automatism
    hutegger    94/02/24    code-page - support and trailer-info added
        
*/
/*h-*/

{ prodict/dictvar.i }
{ prodict/user/uservar.i }
{ prodict/fhidden.i}

DEFINE VARIABLE Dbs         AS CHARACTER    NO-UNDO.
DEFINE VARIABLE file_len    AS INTEGER      NO-UNDO.
DEFINE VARIABLE i           AS INTEGER      NO-UNDO.
DEFINE VARIABLE Seqs        AS CHARACTER    NO-UNDO.
DEFINE VARIABLE stopped     AS LOGICAL      NO-UNDO init true.

DEFINE VARIABLE old-num     AS INTEGER      NO-UNDO. /* DAL */
DEFINE VARIABLE dummy-count AS INTEGER      NO-UNDO. /* DAL */

DEFINE NEW SHARED STREAM ddl.


/* LANGUAGE DEPENDENCIES START */ /*----------------------------------------*/

FORM
  Dbs 	       	    LABEL "Database"  COLON 11 FORMAT "x(32)" SKIP
  _File._File-name  LABEL "Table"     COLON 11 FORMAT "x(32)" SKIP
  Seqs 	       	    LABEL "Sequence"  COLON 11 FORMAT "x(32)" SKIP
  HEADER 
    "Dumping Definitions.  Press " +
     KBLABEL("STOP") + " to terminate the dump process." format "x(70)"
  WITH FRAME working 
  ROW 4 CENTERED SIDE-LABELS ATTR-SPACE USE-TEXT.

COLOR DISPLAY MESSAGES
  _File._File-name Dbs Seqs
  WITH FRAME working.

if TERMINAL <> ""
 then DISPLAY
    ""   @ Dbs
    ""	 @ _File._File-name
    ""   @ Seqs
    WITH FRAME working.

/* LANGUAGE DEPENDENCIES END */ /*------------------------------------------*/

if TERMINAL <> "" 
 then run adecomm/_setcurs.p ("WAIT").

if  user_env[5] = " "
 OR user_env[5] = ? 
 then assign user_env[5] = "".
 
if user_env[5] = ""
 then OUTPUT STREAM ddl TO VALUE(user_env[2]) NO-ECHO NO-MAP NO-CONVERT.
 else OUTPUT STREAM ddl TO VALUE(user_env[2]) NO-ECHO NO-MAP
             CONVERT SOURCE SESSION:CHARSET TARGET user_env[5].

assign SESSION:IMMEDIATE-DISPLAY = yes.

DO ON STOP UNDO, LEAVE:
  if user_env[9] = "a" then DO:
    if TERMINAL <> "" then 
      DISPLAY "(Auto-Connect)" @ Dbs WITH FRAME working.
    RUN "prodict/dump/_dmpdefs.p" ("a",drec_db).
    end.
  else if user_env[9] = "c" then DO:
    if TERMINAL <> "" then 
      DISPLAY user_dbname + " (Collate)" @ Dbs WITH FRAME working.
    RUN "prodict/dump/_dmpdefs.p" ("c",drec_db).
    end.
  else if user_env[9] = "s" then DO:
    if TERMINAL <> "" then 
      DISPLAY user_dbname @ Dbs 
      	"ALL" @ Seqs 
      	WITH FRAME working.
    RUN "prodict/dump/_dmpdefs.p" ("s",drec_db).
    end.
  else 
    FOR EACH DICTDB._File
      WHERE _File._Db-recid = drec_db
       AND ( if user_filename = "ALL"
              then (IF NOT fHidden THEN NOT DICTDB._File._Hidden ELSE DICTDB._File._File-Number > 0)
             else if user_filename begins "SOME"
              then CAN-DO(user_env[1],DICTDB._File._File-name)
              else RECID(DICTDB._File) = drec_file
           )
      BREAK BY DICTDB._File._File-num:
  
      if   FIRST(DICTDB._File._File-num) 
       then do:  /* first _file of this _db */

        if  user_filename = "ALL"
         or user_filename = "SOME MORE"
         or user_filename = "ONE MORE"
         then do:  /* we need db-token */
          if TERMINAL <> ""
           then DISPLAY "ALL" @ Dbs
              WITH FRAME working.

          RUN "prodict/dump/_dmpdefs.p" ("d",drec_db).
          end.     /* we need db-token */
  
        if user_filename = "ALL"
         then do:  /* "all" to dump */
          if TERMINAL <> ""
           then DISPLAY
              user_dbname @ Dbs
      	      "ALL"       @ Seqs
      	      WITH FRAME working.

          RUN "prodict/dump/_dmpdefs.p" ("s",drec_db).
          end.     /* "all" to dump */
        
        end.     /* first _file of this _db */
        
      else
        if TERMINAL <> "" then
          DISPLAY user_dbname @ Dbs
      	    WITH FRAME working.
  
      if TERMINAL <> "" then 
        DISPLAY _File._File-name WITH FRAME working.


/*****************************************************************************************
This code is necessary if you have tables deleted. You can check it in your database and
see if you have gaps in table numbers.
for each _file where _file-number > 0:
  disp _file-name _file-number.
end.
The following code will fill the gaps with DUMMY tables in .df file.
After loading .df file you probably want to delete these DUMMY tables.

Dmitri Levin, DAL 5/12/1997
*****************************************************************************************/
if old-num > 0 and DICTDB._File._File-num - old-num > 1 then do:                 /* DAL */
    do i = 1 to DICTDB._File._File-num - old-num - 1 :                           /* DAL */
        dummy-count = dummy-count + 1.                                           /* DAL */
        PUT STREAM ddl UNFORMATTED "ADD TABLE ""DUMMY"   string(dummy-count) """" skip.    /* DAL */
        PUT STREAM ddl UNFORMATTED "  LABEL ""DUMMY"     string(dummy-count) """" skip.    /* DAL */
        PUT STREAM ddl UNFORMATTED "  DUMP-NAME ""DUMMY" string(dummy-count) """" skip(1). /* DAL */
    end.                                                                         /* DAL */
end.                                                                             /* DAL */
old-num = DICTDB._File._File-num.                                                /* DAL */


      RUN "prodict/dump/_dmpdefs.p" ("t",RECID(_File)).
      end. /* for each _file */

  if user_env[25] <> "AUTO"
   then do:  /* no other _db-schema will follow -> trailer */
      {prodict/dump/dmptrail.i
        &entries      = " "
        &seek-stream  = "ddl"
        &stream       = "stream ddl"
        }  /* adds trailer with code-page-entry to end of file */
        end.    /* no other _db-schema will follow -> trailer */  

  stopped = false.
  end.

file_len = SEEK(ddl).
OUTPUT STREAM ddl CLOSE.

SESSION:IMMEDIATE-DISPLAY = no.
if TERMINAL <> "" then 
  run adecomm/_setcurs.p ("").

if user_env[6] = "no-alert-boxes"
then do:  /* output WITHOUT alert-box */

  if stopped then 
     MESSAGE "Dump terminated.".
   else do:
    if file_len < 3 
     then do:  /* the file is empty - nothing to dump */

      OS-DELETE VALUE(user_env[2]). 
      if TERMINAL <> "" then 
        MESSAGE "There were no " +  
	      (if user_env[9] = "a" then "auto-connect records" else
	       if user_env[9] = "s" then "sequence definitions" else
				         "data definitions"     ) + 
	      " to dump."                                            SKIP
	      "The output file has been deleted.".
      end.
    else 
      if TERMINAL <> "" then 
        MESSAGE "Dump of definitions completed.".
    end.
  
  end.      /* output WITHOUT alert-box */

 else do:  /* output WITH alert-box */

  if stopped
   then MESSAGE "Dump terminated."
      	   VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
   else do:
    if file_len < 3 
     then do:  /* the file is empty - nothing to dump */

      OS-DELETE VALUE(user_env[2]). 
      if TERMINAL <> ""
       then MESSAGE "There were no " +  
	      (if user_env[9] = "a" then "auto-connect records" else
	       if user_env[9] = "s" then "sequence definitions" else
				         "data definitions"     ) + 
	      " to dump."                                            SKIP
	      "The output file has been deleted."
	      VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
      end.
    else if TERMINAL <> ""
     then MESSAGE "Dump of definitions completed." 
	      VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
    end.
  
  end.     /* output WITH alert-box */

if TERMINAL <> ""
 then HIDE FRAME working NO-PAUSE.

RETURN.

Return to myProgress Home Page
    

    

    

    

    

    

    

1