Kbase 12244: CRC: How to use crc in large applications.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
CRC: How to use crc in large applications.
INTRODUCTION:
=============
Progress Software Technical Support gets many questions
about cyclic redundancy check and the error messages: "**Database is
not consistent with <program> -- try recompiling. (482)" and "** CRC
for <filn> does not match CRC in <procedure>--try recompiling. (1896)"
This Knowledge base entry describes how to resolve these errors.
WHY YOU NEED TO KNOW THIS:
==========================
CRC is very powerful. It has been used to compile the Data
Dictionary, so it works against any PROGRESS database.
PROCEDURAL APPROACH:
====================
We will use 3 databases in this entry: db1, db2 & db3, where:
- db1 is the development database,
- db2 is a "BASIC" database (i.e. doesn't contain any data) and
- db3 is the production database.
After the application is completed (in db1), the development team will
create either an incremental or full data definition file from the
data dictionary. We will call this file "db.df".
Our goal is to make the transition to our production as smooth as
possible, i.e. we will use db2 to compile all the code, so once the
db3 data definitions have been upgraded, system is ready to go.
Objectives to achieve our goal:
1. Load the data definitions (db.df) into db2.
2. Start Progress with -crc option and use either alias or logical
name which will be identical to db3. Compile all code with save
option.
3. Load the data definitions (db.df) into db3. This will take some
time on large databases, because all files effected by the schema
changes will have to be updated.
4. The application has been ported from development to production.
ONLINE PROCEDURES OR UTILITIES:
===============================
We have written the following procedure in order to verify that the
crc's are identical for db2 & db3:
/*********************** crc.p ************************/
/* File: crc.p */
/* Date: August 1993 */
/* Dept: PROGRESS SOFTWARE TECHNICAL SUPPORT */
DEF VAR p-name AS CHAR FORMAT "x(15)" LABEL "Program Name".
DEF VAR r-name AS CHAR FORMAT "x(15)".
DEF VAR i AS INT.
DEF STREAM prg.
DEF STREAM crcprg.
OUTPUT STREAM crcprg TO chkcrc.p .
PUT STREAM crcprg "PAUSE 0 BEFORE-HIDE. " SKIP.
FORM WITH FRAME S 16 DOWN.
FOR EACH _FILE:
IF SUBSTR(_FILE-NAME, 1, 1) <> "_" THEN DO:
ASSIGN i = i + 1.
ASSIGN p-name = "crc/file" + STRING(i, "9999") + ".p"
r-name = "crc/file" + STRING(i, "9999") + ".r" .
DISPLAY "Creating" _File-name FORMAT "x(15)" p-name WITH FRAME S.
OUTPUT STREAM prg TO VALUE(p-name).
PUT STREAM prg "FIND FIRST " _FILE-NAME " NO-ERROR." SKIP.
OUTPUT STREAM prg CLOSE.
DISPLAY "Compiling " WITH FRAME S.
COMPILE VALUE(p-name) SAVE.
PUT STREAM crcprg
'MESSAGE "Checking ' _FILE-NAME FORMAT "x(15)"
'with ' r-name '".' SKIP
'RUN ' r-name '.' SKIP.
DISPLAY "Done. " WITH FRAME S.
DOWN WITH FRAME S.
PAUSE 0 BEFORE-HIDE.
END.
END.
OUTPUT STREAM crcprg CLOSE.
/******************* End of crc.p *********************/
After db2 has been updated with db.df, do the following:
1. Make a directory called "crc".
2. Run crc program with the following command:
pro db2 -ld db -crc -e 60 -p crc.p
This command will create compiled code (in the crc directory)
for each table in the database (except tables starting with "_").
It will also create a program called chkcrc.p, which will check
all compiled programs in the crc directory.
3. After db3 has been updated, run chkcrc with the following option:
pro db3 -ld db -crc -e 60 -p chkcrc.p
4. Conclusion:
A: IF chkcrc.p completes without errors, we have proven that
the files in db2 & db3 have the same crc.
B: IF chkcrc.p produces an error message, we have shown that
that the procedure to update data definitions for db2 and db3
have failed, i.e. db2 & db3 data definition have not been
updated in correct way (or some schema changes have occured
in either db2 or db3). Thus, compiling code on db2 with crc
will not work correctly on db3.
REFERENCES TO WRITTEN DOCUMENTATION:
====================================
* Version 6 Documentation Bulletin VIII: FEAT 20-23.
* Version 6 Technical Bulletin Volume 6, Edition 12: Page 10-11 or
* Version 6 Technical Bulletin Volume 6, Edition 14: Page 7-8.
Progress Software Technical Support Note # 12244