CMVC FREQUENTLY ASKED QUESTIONS:
                        VERSION CONTROL AND DATABASE SYNCHRONIZATION ISSUES
 
 
                                                 Document Number TR 29.2297
 
 
                                                   Lee Perlov, Angel Rivera
 
 
                                            CMVC/TeamConnection Development
                                                     IBM Software Solutions
                                     Research Triangle Park, North Carolina
                                               Copyright (C) 1997 IBM Corp.
                                                       All rights reserved.
 
 
          ii  CMVC FAQ: version control
 
 
                                                                   ABSTRACT
 
 
          This technical report documents the interaction between the ver-
          sioning system (such as SCCS) and the relational database used by
          CMVC for archiving files in the library system.  Also, it pro-
          vides answers to frequently asked questions from CMVC family
          administrators and general users.
 
 
          ITIRC KEYWORDS
 
          o   CMVC
 
          o   version control
 
          o   fixing problems
 
          o   database and SCCS synchronization
 
 
                                                              ABSTRACT  iii
 
 
          iv  CMVC FAQ: version control
 
 
                                                          ABOUT THE AUTHORS
 
 
          LEE PERLOV
 
          Mr. Perlov is a Staff Software Engineer in the
          TeamConnection/CMVC development group.  He started working for
          IBM in 1985 in Gaithersburg, Md, working in the Federal Systems
          Division on various projects for the United States intelligence
          community.  He then moved to RTP to work on library development
          and support.
 
          Mr. Perlov received a B.S.Acc degree in Accounting from the Uni-
          versity of Florida in 1983.  He also completed two years of grad-
          uate work in the Department of Computer Science at the University
          of Florida.
 
 
          ANGEL RIVERA
 
          Mr. Rivera is an Advisory Software Engineer and team lead for the
          development of CMVC 2.3.  He joined IBM in 1989 and since then
          has worked in the development and support of library systems.
 
          Mr. Rivera has an M.S. in Electrical Engineering from The Univer-
          sity of Texas at Austin, and B.S. in Electronic Systems Engi-
          neering from the Instituto Tecnologico y de Estudios Superiores
          de Monterrey, Mexico.
 
 
                                                       ABOUT THE AUTHORS  v
 
 
          vi  CMVC FAQ: version control
 
 
                                                                   CONTENTS
 
 
          ABSTRACT   . . . . . . . . . . . . . . . . . . . . . . . . .  III
            ITIRC KEYWORDS   . . . . . . . . . . . . . . . . . . . . .  iii
 
          ABOUT THE AUTHORS  . . . . . . . . . . . . . . . . . . . . . .  V
            Lee Perlov   . . . . . . . . . . . . . . . . . . . . . . . .  v
            Angel Rivera   . . . . . . . . . . . . . . . . . . . . . . .  v
 
          FIGURES  . . . . . . . . . . . . . . . . . . . . . . . . . .   IX
 
          1.0  INTRODUCTION  . . . . . . . . . . . . . . . . . . . . . .  1
            1.1  About this and previous technical reports   . . . . . .  1
            1.2  About CMVC and TeamConnection   . . . . . . . . . . . .  1
            1.3  Acknowledgements  . . . . . . . . . . . . . . . . . . .  2
            1.4  WARNING! Read this section before attempting to fix an
            SCCS problem   . . . . . . . . . . . . . . . . . . . . . . .  2
 
          2.0  BACKGROUND INFORMATION ON THE VERSION CONTROL OF CMVC      5
            2.1  Comparison of functionality between SCCS and PVCS in
            CMVC   . . . . . . . . . . . . . . . . . . . . . . . . . . .  5
            2.2  Comparison of benefits between SCCS and PVCS in CMVC     7
            2.3  What is the event sequence in version control when
            checking out a file?   . . . . . . . . . . . . . . . . . . .  8
            2.4  What is the event sequence in version control when
            checking in a file?  . . . . . . . . . . . . . . . . . . . .  9
            2.5  What are the internal file names used by CMVC?  . . .   10
            2.6  What are the different file types in CMVC?  . . . . .   12
 
          3.0  SCCS AND CMVC   . . . . . . . . . . . . . . . . . . . .   15
            3.1  How CMVC uses SCCS  . . . . . . . . . . . . . . . . .   15
            3.2  Examples of using all the SCCS keywords with CMVC   .   16
            3.3  Files that are stored entirely in SCCS archive files    17
            3.4  Files that are only partially stored in SCCS archive
            files  . . . . . . . . . . . . . . . . . . . . . . . . . .   17
            3.5  How is the CMVC_BINARY_THRESHOLD variable used?   . .   19
            3.6  What are the SCCS commands and how are they used?   .   20
 
          4.0  FREQUENTLY ASKED QUESTIONS BY END USERS   . . . . . . .   23
            4.1  How to reclaim space by deleting SCCS archive files     23
             4.1.1  Process to remove records of files from the
             database  . . . . . . . . . . . . . . . . . . . . . . . .   23
             4.1.2  Process to delete unreferenced SCCS archive files    24
            4.2  Are there preventive measures to avoid synchronization
            problems?  . . . . . . . . . . . . . . . . . . . . . . . .   27
             4.2.1  Finding SCCS and database lock problems early  . .   27
             4.2.2  Finding corrupted SCCS archive files early   . . .   28
            4.3  Can I control the version numbers for files?  . . . .   29
            4.4  What are the Archive and Restore limitations for
            versioning?  . . . . . . . . . . . . . . . . . . . . . . .   30
            4.5  Why is there a line length limit for text files?  . .   31
 
 
                                                              Contents  vii
 
 
            4.6  How to find out the file name in the vc tree (Reverse
            vcPath)  . . . . . . . . . . . . . . . . . . . . . . . . .   33
 
          5.0  ERROR RECOVERY: GENERAL PROCEDURES  . . . . . . . . . .   35
            5.1  Why do SCCS/database synchronization problems occur in
            CMVC?  . . . . . . . . . . . . . . . . . . . . . . . . . .   35
            5.2  General system problems that impact the versioning in
            CMVC   . . . . . . . . . . . . . . . . . . . . . . . . . .   36
            5.3  Preparing to make a fix to a versioning problem   . .   37
            5.4  Procedure to diagnose a versioning problem in CMVC  .   38
            5.5  Hints on debugging version control problems   . . . .   40
 
          6.0  ERROR RECOVERY: SPECIFIC SCENARIOS  . . . . . . . . . .   41
            6.1  SCCS archive has a file lock, but the database does
            not  . . . . . . . . . . . . . . . . . . . . . . . . . . .   41
            6.2  Unable to checkout a locked file with force option  .   41
            6.3  The database has a lock record, but the SCCS archive
            does not   . . . . . . . . . . . . . . . . . . . . . . . .   42
            6.4  One version of a file is not in CMVC  . . . . . . . .   43
            6.5  One version of a file is missing from an SCCS archive   43
             6.5.1  Missing from type text and special files   . . . .   43
            6.6  Corruption of SCCS archive file   . . . . . . . . . .   45
            6.7  SCCS archive is damaged beyond repair   . . . . . . .   45
             6.7.1  If something of the SCCS archive can be recovered    46
             6.7.2  If the entire archive is corrupted   . . . . . . .   46
            6.8  SCCS gives a warning message when the sfile is more
            than 1 year old  . . . . . . . . . . . . . . . . . . . . .   47
            6.9  Differences in a file between checked in version and
            the extracted one  . . . . . . . . . . . . . . . . . . . .   47
            6.10  Message: binary delta unsuccessful, it has reached
            the threshold limit  . . . . . . . . . . . . . . . . . . .   48
            6.11  Getting a strange error when extracting an invalid
            version number   . . . . . . . . . . . . . . . . . . . . .   49
            6.12  How to deal with the error 0010-781  . . . . . . . .   49
            6.13  How to recover when the error 0010-783 is displayed    50
            6.14  VC files out of sync with DB when database was
            restored from old copy   . . . . . . . . . . . . . . . . .   52
 
          APPENDIX A.  BIBLIOGRAPHY  . . . . . . . . . . . . . . . . .   57
            A.1  How to get electronic copies of manuals and techical
            reports  . . . . . . . . . . . . . . . . . . . . . . . . .   57
             A.1.1  IBM Intranet   . . . . . . . . . . . . . . . . . .   57
             A.1.2  Internet   . . . . . . . . . . . . . . . . . . . .   58
 
          APPENDIX B.  COPYRIGHTS, TRADEMARKS AND SERVICE MARKS  . . .   61
 
 
          viii  CMVC FAQ: version control
 
 
                                                                    FIGURES
 
 
           1.  Sample usage of SCCS keywords   . . . . . . . . . . . .   16
           2.  Check Versions table for sourceId not in the Files table  25
           3.  Check Files table for sourceId not in Versions table  .   25
           4.  Check Files and Versions table for a specific sourceId    26
           5.  Korn shell sample to find bad SCCS file locks   . . . .   28
           6.  SCCS archives of all files of the name PATH/FILE  . . .   38
           7.  Files common to an SCCS archives  . . . . . . . . . . .   39
 
 
                                                                Figures  ix
 
 
          x  CMVC FAQ: version control
 
 
                                                          1.0  INTRODUCTION
 
 
          This technical report documents the interaction between the ver-
          sioning system (such as SCCS) and the relational database used by
          CMVC for archiving files in the library system.  Also, it pro-
          vides answers to frequently asked questions from CMVC family
          administrators and general users.
 
          This technical report is organized as follows:
 
          1.  Background on the version control architecture of CMVC
          2.  How SCCS and CMVC interact
          3.  Frequently asked questions from end users
          4.  Error recovery: general procedures
          5.  Error recovery: specific scenarios
 
 
          1.1  ABOUT THIS AND PREVIOUS TECHNICAL REPORTS
 
          This document, as well as other recently released technical
          reports related to CMVC, contains some information that was pre-
          viously available in other "unofficial" documents.  We have
          endeavored to better organize the information and improve its
          readability so that you will find it more useful.
 
          This technical report supersedes the technical report TR 29.2131
          CMVC: FIXING DATABASE AND SCCS SYNCHRONIZATION PROBLEMS and it
          replaces the CMVC readme file
          /USR/LPP/CMVC/DOC/README.FIX.DB.SCCS.SYNC.PROBLEMS.  Please use
          the new technical report when possible, as we have made many
          improvements and will be removing the older documents from our
          shipped media and ftp sites.
 
 
          1.2  ABOUT CMVC AND TEAMCONNECTION
 
          TeamConnection is the successor product to CMVC.  It has greatly
          expanded capabilities and is built upon an object model.  While
          this and related technical reports discuss CMVC issues, we will
          periodically refer to new solutions provided in TeamConnection.
 
          Where a CMVC technical report covers a topic that might be of
          importance to TeamConnection users and if the TeamConnection doc-
          umentation does not already cover the topic, a TeamConnection
          technical report is or will be available.
 
 
                                                            Introduction  1
 
 
          1.3  ACKNOWLEDGEMENTS
 
          Many of the questions and answers that are compiled in this tech-
          nical report were obtained from the CMVC forum in the IBMPC con-
          ferencing disk, and from the CMVC6000 forum in the IBMUNIX
          conferencing disk.
 
          We want to thank the main participants in these electronic forums
          for their support!
 
          Also, we want to thank Dodde Stark for editing this technical
          report.
 
 
          1.4  WARNING! READ THIS SECTION BEFORE ATTEMPTING TO FIX AN SCCS
          PROBLEM
 
          Since directly modifying ANY data within CMVC can be risky, here
          is a list of warnings and caveats:
 
          1.  If you rename, delete or move files in the vc directory
              structure, you will be doing this at your own risk.  Problems
              with CMVC resulting from such changes do not constitute
              "defects in the product".  IBM has a services organization
              that can provide fee-based services to help you in such
              cases.
 
          2.  Before attemtping to follow any of the recovery procedures
              described in this technical report, it is recommended that
              you stop the CMVC daemons and do a complete backup of both
              the database and the file system.  In case there are prob-
              lems, it is important to have a means of recovery.  CMVC pro-
              vides a sample backup utility, "backupCMVC", in the samples
              directory.
 
          3.  Save copies of all files before making changes.
 
          4.  Do not edit any SCCS archive files directly.  They are
              binary.
 
          5.  Do not modify any data in the database.
 
          6.  Verify that syslog is running.
 
              If it is not running, see the technical report "CMVC fre-
              quently asked questions:  hints and tips on using databases
              and OEM platforms", section "Where are the error messages
              from the CMVC daemon and databases?".
 
              You can also see Chapter 14 "Ongoing Maintenance" in CMVC
                                                                   ____
              Server Administration and Installation, Version 2 Release 3
              ___________________________________________________________
              to set up syslog.
 
 
          2  CMVC FAQ: version control
 
 
              Then, restart the daemons and recreate the problem to see if
              there are associated error messages in your syslog file.
 
          7.  If you are uncertain, please contact IBM Support before using
              these procedures.
 
 
                                                            Introduction  3
 
 
          4  CMVC FAQ: version control
 
 
                 2.0  BACKGROUND INFORMATION ON THE VERSION CONTROL OF CMVC
 
 
          2.1  COMPARISON OF FUNCTIONALITY BETWEEN SCCS AND PVCS IN CMVC
 
          QUESTION:
 
          What are the differences in functionality between SCCS and PVCS
          as used by CMVC?
 
          ANSWER:
 
          NOTE:  CMVC supports PVCS only on AIX 3.2.
 
          The CMVC server will store text and binary files regardless of
          the version control mechanism (SCCS or PVCS):
 
          o   SCCS highlights
 
              -   Only text files can be delta versioned.
              -   Text deltas are forward-versioned.
 
                  In other words, for each new version only the changes are
                  stored.  The result is that it takes longer to retrieve
                  the newest version of a file as more deltas are applied.
              -   Binary files are not supported by SCCS.
 
                  CMVC implements a backward-versioned mechanism for binary
                  files, where the newest version of the file is stored
                  whole (unchanged), and all previous versions are deltas
                  from the newest.  As a result, the newest version is
                  retrieved faster and each older version takes incre-
                  mentally longer.
 
                  For more details on the CMVC binary file support when
                  using SCCS, see 3.4, "Files that are only partially
                  stored in SCCS archive files" on page 17.
              -   Keyword expansion is supported for text files.  SCCS has
                  a unique set of keywords.
              -   File compression is not supported.
 
          o   PVCS highlights
 
              -   Text and binary files are delta versioned.
              -   Deltas are reverse-versioned.
              -   Keyword expansion is supported on text files.  PVCS has a
                  unique set of keywords.
              -   File compression is a configurable option.
 
 
                   Background information on the version control of CMVC  5
 
 
          o   Version numbering scheme
 
              SCCS and PVCS use different version numbering conventions
              when branches occur in the development of a file:
 
              -   SCCS
 
                  SCCS branches files as follows
                  (Release.Level.Branch.Sequence):
 
                          1.1
                          1.2
                          1.3 -- 1.3.1.1
                           |     1.3.1.2 -- 1.3.2.1
                           |        |       1.3.2.2
                           |     1.3.1.3
                          1.4
 
                  The CMVC server only uses Release 1 of SCCS.
 
                  The maximum SCCS identifier (SID) is 1.999.999.999.
 
              -   PVCS
 
                  PVCS branches files as follows:
 
                          1.1
                          1.2
                          1.3 -- 1.3.1.0
                           |     1.3.1.1 -- 1.3.1.1.1.0
                           |        |       1.3.1.1.1.1 -- 1.3.1.1.1.1.1.0
                           |        |            |         1.3.1.1.1.1.1.1
                           |        |       1.3.1.1.1.2
                           |     1.3.1.2
                          1.4
 
                  The maximum PVCS version number can have 256 characters.
                  The CMVC server has imposed a length restriction of 48
                  characters (12 levels of branching).  When the maximum
                  SID length for the files stored in PVCS is reached, the
                  file cannot be checked out.
 
                  To continue using the file, extract the version you want
                  and create the file by a new name or delete and destroy
                  the original file within the current release, and then
                  reuse the same name when you create the file again.
 
 
          6  CMVC FAQ: version control
 
 
          2.2  COMPARISON OF BENEFITS BETWEEN SCCS AND PVCS IN CMVC
 
          QUESTION:
 
          What are the benefits of using SCCS or PVCS in CMVC?
 
          ANSWER:
 
          o   PVCS is supported as an alternate source code control mech-
              anism on AIX 3.2.  Since it is not used frequently, there
              will be no discussions of specific PVCS commands in this
              technical report.
 
              There are equivalent PVCS commands for all CMVC commands.
              See PVCS Version Manager Reference Guide for details.
                  ____________________________________
 
          o   Benefits of PVCS:
 
              -   A file can begin by containing text data and then become
                  binary without problems.
 
          o   Benefits of SCCS:
 
              -   You do not have to pay support fees for using SCCS.
 
              -   There is no separate setup required for SCCS, as it is
                  part of most Unix operating systems.
 
              -   SCCS is used by most of our customers, and is therefore
                  better tested and maintained.
 
          o   Changes in CMVC 2.3 that make PVCS unnecessary:
 
              -   SCCS does not support binary data.  In prior versions of
                  CMVC, binary files were stored uncompressed, using a
                  whole copy for each version.
 
                  Since this was inefficient, CMVC now performs reverse
                  delta versioning of each binary file.  CMVC now handles
                  the Ctrl-Z character that is typically appended to the
                  end of text OS/2 and Windows files.  As a result, a text
                  file will be formatted properly for OS/2, Windows and
                  Unix.
 
          o   Conversion from PVCS to SCCS and vice versa:
 
              -   CMVC 2.3 uses the numbering scheme of either SCCS or
                  PVCS, but since they differ it is not easy to convert
                  from using one system to another.
 
              -   The version numbers are isolated to the versions table.
 
              -   CMVC comes with a sample/binaryMerge.c tool that allows a
                  family administrator to convert CMVC binary delta files
 
 
                   Background information on the version control of CMVC  7
 
 
                  back into full source files without using CMVC commands.
                  This would be necessary when transferring files from SCCS
                  to PVCS.
 
                  IBM provides fee-based services to assist migrating PVCS
                  data to CMVC using SCCS.
 
 
          2.3  WHAT IS THE EVENT SEQUENCE IN VERSION CONTROL WHEN CHECKING
          OUT A FILE?
 
          QUESTION:
 
          What is the event sequence in version control when checking out a
          file?
 
          ANSWER:
 
          o   Client Side
 
              1.  Compute the local and server path names.
 
                  Based on the input parameters supplied by the user, the
                  client determines the name of the local file and the name
                  of the file that the CMVC has in its development environ-
                  ment.
 
              2.  Prepare to receive the file from the server.
 
                  If the file is not destined to stdout, then the client
                  determines the directory location where the user wants
                  the file deposited and reserves a temporary file name in
                  that directory.
 
              3.  Issue a request to the server to check out a specific
                  file in a specific release.
 
              4.  Receive the file from the server (for example, set the
                  file mode to 640).
 
          o   Server Side
 
              1.  Prepare a temporary file (in /tmp of the server) for the
                  network file transfer.
 
                  This is where the contents of the version control file
                  will be placed.  The server assumes that there will be
                  enough space in the /tmp directory.
 
              2.  Perform various checks before getting the file from the
                  version control system.
 
              3.  Get the file from the version control system.
 
 
          8  CMVC FAQ: version control
 
 
                  An SCCS or PVCS command is issued to get the file for
                  editing (that is, the version control system will reserve
                  a version number for any subsequent checkin action).
 
                  If SCCS is the underlying version control system, then a
                  p.XX file is created (the XX is the same as in the s.XX
                  file) in the same directory of the VC tree.  This is how
                  SCCS indicates that there is a lock on the file.
 
              4.  Make an entry in the FilesOut database table.
 
                  This is how the CMVC server controls who has what file
                  checked out.
 
              5.  Delete the file from /tmp after the client has received
                  it.
 
                  This is done through the client-server protocol hand-
                  shaking.  The server knows when the client has completed
                  the transfer of the file.
 
 
          2.4  WHAT IS THE EVENT SEQUENCE IN VERSION CONTROL WHEN CHECKING
          IN A FILE?
 
          QUESTION:
 
          What is the event sequence in version control when checking in a
          file?
 
          ANSWER:
 
          o   Client Side
 
              1.  Compute the local and server path names.
 
                  Based on the input parameters supplied by the user, the
                  client determines the name of the local file and the name
                  of the file that the CMVC has in its development environ-
                  ment.
 
              2.  Issue a request to the server to check in a specific file
                  for a specific release.
 
              3.  Change the file permissions to read-only after the server
                  has received a copy of the file.
 
          o   Server Side
 
              1.  Prepare a temporary file (in /tmp of the server) for the
                  network file transfer.  For example,
                  /tmp/cmvcErEFoAwAAA/ErEFoAwAAB.
 
 
                   Background information on the version control of CMVC  9
 
 
                  Notice that the name of the file and the name of the
                  directory are only slightly different.
 
              2.  Perform various checks before getting the file from the
                  version control system.
 
              3.  Make an entry in the Versions table for the new version
                  of the file that is being checked in to the version
                  control system.
 
              4.  Check the file into the version control system.
 
                  a.  The /tmp/cmvcErEFoAwAAA/ErEFoAwAAB file is renamed to
                      the name that the version control system expects
                      (such as /tmp/cmvcErEFoAwAAA/08)
 
                  b.  A copy of the original SCCS file from the vc direc-
                      tory is obtained and copied into this same directory;
                      the file is named /tmp/cmvcErEFoAwAAA/08.recovery.
                      This will be used if it is necessary to recover from
                      version control problems otherwise it will be erased
                      after the checkin is successful.
 
                  c.  The amount of space required to store the new delta
                      is estimated by adding 10% to the original size of
                      the file in the vc tree and to the size of the file
                      being checked in.  There needs to be this much space
                      in /tmp and in the version control tree.  If the
                      space is available, the checkin request is issued to
                      the version control system.
 
                  d.  If SCCS is the underlying version control system,
                      then a p.XX file is removed (the XX is the same as in
                      the s.XX file).  This is how SCCS indicates that
                      there is no longer a lock on the file.
 
              5.  Remove all temporary files on the server.
 
              6.  Remove the entry in the FilesOut database table.
 
 
          2.5  WHAT ARE THE INTERNAL FILE NAMES USED BY CMVC?
 
          QUESTION:
 
          In the CMVC family account there is a "vc" directory with lots of
          files that have different names than those specified by the
          users.  What are these internal file names used by CMVC?
 
          ANSWER:
 
          User's files are stored in PVCS or SCCS archives within the "vc"
          directory structure.  These archives are given an internally gen-
 
 
          10  CMVC FAQ: version control
 
 
          erated path and name when a new archive is created.  This name is
          stored in a short-hand form in the sourceID field of the Files
          and Versions tables.
 
          The family administrator can find the location of a specific CMVC
          file in the vc directory structure by using the vcPath tool.  The
          vcPath tool expands the sourceId into a path and archive
          filename.
 
          In most cases the users are unaware that their files are given a
          sourceId and there is no need for them to know this information.
          The CMVC server handles the file name translation transparently.
 
          The sourceId is based on a six digit number generated from an
          internal counter, stored as a record in the Sequence table.
 
          o   This was done because storing all of the files in a single
              directory would be an inefficient use of the file system
              since files in a directory are searched sequentially.
          o   Therefore a directory hierarchy is imposed on the version
              control files.
          o   For a file with a surrogate name of 012345, the directory
              location would be $HOME/VC/0/1/2/3 and the name of the file
              in this directory would be S.45
          o   The surrogate name is stored in the sourceId column of a file
              record in the Files database table.
          o   There is a maximum of 100 files per vc directory.
          o   There is a maximum of 1 million files per CMVC family.
          o   The first file to be created is $HOME/vc/0/0/0/0/s.01
          o   The last file to be created is $HOME/vc/9/9/9/9/s.99
 
          Binary files in an CMVC - SCCS environment can be identified by
          their directory names.  For example: $HOME/vc/0/0/0/1/b.08 is the
          directory that contains the versions of a binary file.
 
          o   Within this directory there is an s.binary file and various
              files that represent the versions of the binary file that the
              CMVC server knows about (such as, 1.1, 1.2 and 1.3).
 
          o   The s.binary file is an empty SCCS file that is used to store
              the delta information about the binary file.  This enables
              the CMVC server to provide the same level of branching
              support for binary files as is available for text files
 
          o   The 1.1, 1.2 and 1.3 files are the versions of the binary
              file.
 
 
                  Background information on the version control of CMVC  11
 
 
          2.6  WHAT ARE THE DIFFERENT FILE TYPES IN CMVC?
 
          QUESTION:
 
          What are the different file types in CMVC?
 
          ANSWER:
 
          There are 5 different types of files in CMVC.  The type of a file
          can be explicitly set during "File -create", but the contents of
          the file can require CMVC to change that type.
 
          o   The following 2 types are the only ones that the user can set
              explicitly:
 
              -   text
 
                  This is the default; however, the file is scanned for
                  sequence of characters that SCCS cannot handle; if these
                  sequences are found, then the type is changed to "binary"
                  to avoid problems with SCCS.
 
              -   binary
 
                  When BINARY is selected, CMVC uses the binary algorithms
                  explained in 3.4, "Files that are only partially stored
                  in SCCS archive files" on page 17.  The contents of
                  binary files are never altered by CMVC.  As a result,
                  there is no expansion of SCCS keywords.
 
          o   The following 3 types are automatically given by CMVC when
              certain conditions are present in text files and the file
              cannot be stored unmodified in SCCS:
 
              -   long
 
                  A text file that has at least 1 line with a row of more
                  than 512 characters.
 
              -   special
 
                  A text file from OS/2, DOS, Windows that ends with a
                  Ctrl-Z character.
 
              -   longSpecial
 
                  A text file from OS/2, DOS, Windows that ends with a
                  Ctrl-Z character and has at least 1 line with a row that
                  has more than 512 characters.
 
          o   For example, if a text file contains a <Ctrl-Z> character at
              the end, the file type will be stored as SPECIAL instead of
              TEXT.  Since <Ctrl-Z> is a binary character that SCCS cannot
              store, the <Ctrl-Z> is removed before the file is stored in
 
 
          12  CMVC FAQ: version control
 
 
              the SCCS archive.  When the file is checked out or extracted,
              the <Ctrl-Z> is appended to the file.
 
              NOTE:  Once a file is created as type text or special, it
              cannot be converted to binary (that is, to binary, long or
              longSp) or vice versa.  For example, an error occurs when a
              user attempts to check in a file containing binary charac-
              ters, such as characters with a value greater than X'7F'.
 
          o   The information about the attribute 'type' is stored in the
              FileView view in the CMVC database (See CMVC User Reference,
              Chapter 6 for more information).  For example, the following
              SQL "where" clause can be used in the Report command to find
              out which files in a release are of binary type (the command
              should fit in one line; here it is broken into 2 lines for
              readability):
 
                   Report -view FileView -where "releaseName = 'yourRelease' and \
                                                 type = 'binary'"
 
 
                  Background information on the version control of CMVC  13
 
 
          14  CMVC FAQ: version control
 
 
                                                         3.0  SCCS AND CMVC
 
 
          3.1  HOW CMVC USES SCCS
 
          QUESTION:
 
          How CMVC uses SCCS
 
          ANSWER:
 
          The contents of the files controlled by CMVC are stored in the vc
          directory of the family account.
 
          Each file is pointed to by one or more records in the Files and
          Versions tables.  There is one record in the Files table for each
          release that points to the file.  There is one record in the Ver-
          sions table for each version of the file contained in the SCCS
          archive.  When releases are linked, each record in the Files
          table will point to the same record in the Versions table.
 
          The FileView database view identifies the current and committed
          versions of each file in each release.  This is done by joining
          the Files and Versions tables.
 
          The directory structure of the vc tree contains four levels of
          directories, vc/0/0/0/0 through vc/9/9/9/9, each containing up to
          99 files, 01 through 99.  The number becomes part of the name of
          the SCCS archive file (for example s.45).  A total of 1,000,000
          files may be stored by CMVC.
 
          The directory and file location of each SCCS archive file in the
          vc tree is stored in the SOURCEID field.  The directory numbers
          are concatenated with the NN from s.NN, b.NN.  Here is an
          example:
 
            $HOME/vc/0/1/2/3/s.45 would be stored as "sourceId=12345"
 
          There are restrictions on the data contained within files stored
          in SCCS.  As a result, files are stored in the vc tree based on
          the TYPE field in the File table.  The following sections
          describe the possible values for the type field and the how they
          are stored in the vc tree:
 
 
                                                          SCCS and CMVC  15
 
 
          3.2  EXAMPLES OF USING ALL THE SCCS KEYWORDS WITH CMVC
 
          QUESTION:
 
          Examples of using all the SCCS keywords with CMVC
 
          ANSWER:
 
          The following is an example using SCCS keywords.  This is the
          formatted output of a real file stored in CMVC that shows all the
          SCCS keywords handled by CMVC.  SCCS and PVCS keywords are docu-
          mented in Chapter 9 of the "CMVC User's Reference manual".
 
 
          KEYWORD             EXAMPLE OF EXPANSION
          %W% PATH NAME, COMPONENT, CMVC RELEASE: sccs.keywords, test-play, test-play
          %A% SHORTHAND FOR "WHAT" STRINGS.
                              THE COMBINATION OF Z,Y,M,I,Z: @(#) 30 1.3@(#)
                              %Z% THE 4-CHARACTER STRING @(#) FOR WHAT: @(#)
                              %Y% SCCS MODULE TYPE FLAG:
                              %M% SCCS MODULE NAME: 30
                              %I% COMPLETE VERSION NUMBER (SID): 1.3
                              %Z% THE 4-CHARACTER STRING @(#) FOR WHAT: @(#)
          %I% COMPLETE VERSION NUMBER (SID).
                              THE COMBINATION OF R,L,B,S: 1.3
                              %R% SCCS RELEASE (NOT CMVC RELEASE): 1
                              %L% SCCS LEVEL (NOT CMVC LEVEL): 3
                              %B% SCCS BRANCH: 0
                              %S% SCCS SEQUENCE: 0
          %D% DATE OF THE EXTRACTION (YY/MM/DD): 96/02/09
          %H% DATE OF THE EXTRACTION (MM/DD/YY): 2/9/96
          %T% TIME OF THE EXTRACTION (HH:MM:SS): 15:33:15
          %E% DATE OF THE NEWEST DELTA (YY/MM/DD): 96/02/09
          %G% DATE OF THE NEWEST DELTA (MM/DD/YY): 2/9/96
          %U% TIME OF THE NEWEST DELTA (HH:MM:SS): 15:32:56
          %F% THE SCCS FILE NAME: /home/cmvctest/vc/0/0/0/3/s.30
          %P% THE FULL PATH NAME OF SCCS FILE: /home/cmvctest/vc/0/0/0/3/s.30
          %C% THE CURRENT LINE NUMBER: 36
 
          Figure 1. Sample usage of SCCS keywords
 
 
          16  CMVC FAQ: version control
 
 
          3.3  FILES THAT ARE STORED ENTIRELY IN SCCS ARCHIVE FILES
 
          QUESTION:
 
          What are the files that are stored entirely in SCCS archive
          files?
 
          ANSWER:
 
          Files of type TEXT and SPECIAL are stored entirely in SCCS
          archive files.
 
          SCCS archives have 2 file components each:
 
          S.NN      The history file, containing text and version history.
                    This includes timestamps and other information related
                    to changes in the file.  The file contents are stored
                    efficiently using a forward delta algorithm.
 
          P.NN      The lock file.  It exists when a lock is in place on a
                    version of the file.  A lock file contains the cur-
                    rently locked version number and the next version
                    number (after the file is checked in).
 
          For example, the file s.45 is type TEXT.  All versions of the
          file are stored in s.45.  When a file is locked by a release, the
          file p.45 is created and a record is added indicating which
          version of the file is locked.
 
          If the current version of the release locking the file is 1.2,
          then the next version number will be 1.3 (unless 1.3 already
          exists and a branch is forced; creating 1.2.1.1).
 
          Continuing the example, if multiple releases lock different ver-
          sions of file s.45, there will be multiple entries in p.45.  If
          the files are currently linked in the two or more releases, then
          there will be only one entry in p.45.  Each entry in p.45 will
          have a unique combination of current and next version numbers.
 
 
          3.4  FILES THAT ARE ONLY PARTIALLY STORED IN SCCS ARCHIVE FILES
 
          QUESTION:
 
          What are the files that are partially stored in SCCS archive
          files?
 
          ANSWER:
 
          File of type BINARY, LONG and LONGSP are stored in a combination
          of:
 
 
                                                          SCCS and CMVC  17
 
 
          o   SCCS archive files.
          o   Separate files containing full copies of binary files or
              reverse deltas of the difference between binary files.
 
          Binary files contain data that cannot be stored in SCCS.  Since
          binary files tend to be large, whenever possible CMVC uses a
          reverse delta algorithm to create a delta file instead of storing
          a full source copy (that is, the entire file unmodified).  CMVC
          also uses the CMVC_BINARY_THRESHOLD variable to determine when to
          stop trying to create a delta file and store the full source
          copy.
 
          For more details on CMVC_BINARY_THRESHOLD, see 3.5, "How is the
          CMVC_BINARY_THRESHOLD variable used?" on page 19.
 
          Binary archives have their own directory, b.NN, containing the
          following file components:
 
          S.BINARY  This SCCS archive file contains only the change history
                    for the file.  The contents of each version of the file
                    are stored in separate files.
 
          N.N       The full source copy of the file, usually the most
                    recent version checked in.  There could be more,
                    depending on the on the value of the
                    CMVC_BINARY_THRESHOLD environment variable.  The name
                    of the file identifies the version number (that is, the
                    version number in s.binary).
 
          N.ND      A delta file.  When merged with a full source copy, it
                    creates the previous version of the file (for example,
                    when 1.2d is merged with 1.3, the resulting file is
                    version 1.2).
 
          P.BINARY  When a file is locked in SCCS, a p.binary file is
                    created.  The behavior for p.binary is the same as p.NN
                    for type text files.
 
          For example, if the binary file b.46 is created and later on is
          updated twice, then there will be three versions of the file.
          The s.binary file will know about versions 1.1, 1.2 and 1.3.
          However, the actual file contents will be in three files in the
          directory b.46: 1.2d, 1.3d and 1.3.
 
          o   File 1.3 is a full source copy of the most current version of
              the file.
          o   If a user extracts version 1.2, then version 1.3 will be
              merged with 1.3d to create 1.2.
          o   If the user extracts version 1.1, then file 1.3 will be
              merged with 1.3d, then the resulting 1.2 will be merged with
              1.2d to create 1.1.
 
          CMVC cancels the binary delta and stores the file as full source
          under the following conditions:
 
 
          18  CMVC FAQ: version control
 
 
          o   The resulting delta file is more than one-half size of the
              full source file being checked in.
 
          o   If CMVC_BINARY_THRESHOLD is set, and the delta file becomes
              larger than the value of CMVC_BINARY_THRESHOLD.
 
          o   If CMVC_BINARY_THRESHOLD is set to 0, then no binary delta is
              attempted and all versions are stored as full source.
 
          In the example above, if CMVC_BINARY_THRESHOLD had been set to 0,
          then the directory would contain: s.binary, 1.1, 1.2 and 1.3.
 
          NOTES:
 
          1.  The contents of the Files and Versions tables are documented
              in "Chapter 7, CMVC Tables for Queries" and "Chapter 6, CMVC
              Views" in CMVC User Reference, Version 2 Release 2.
                        ________________________________________
 
          2.  For details on the content of a delta file and how they are
              merged to create new full source files, see the sample
              program binaryMerge.c, in the samples directory.
 
 
          3.5  HOW IS THE CMVC_BINARY_THRESHOLD VARIABLE USED?
 
          QUESTION:
 
          How is the CMVC_BINARY_THRESHOLD variable used?
 
          ANSWER:
 
          The CMVC_BINARY_THRESHOLD variable should be set in the family
          account when you want to improve performance at the expense of
          space consumed in your family account.
 
          Many customers do not want to create binary deltas, instead, they
          want to store the complete binary file each time they do a file
          change.  To do this, these customers can set the following envi-
          ronment variable:  "export CMVC_BINARY_THRESHOLD=0".
 
          CMVC_BINARY_THRESHOLD affects the processing of any files of type
          BINARY, LONG or LONGSP (type is a column in the Files and
          FileView tables).
 
          The environment variable CMVC_BINARY_THRESHOLD is used as
          follows:
 
          o   When the threshold is reached, the following process is
              invoked:
 
              1.  The difference tool stops processing.
 
 
                                                          SCCS and CMVC  19
 
 
              2.  A full copy of the previous version of the file is saved,
                  instead of a difference file containing only the changes
                  necessary to reconstruct the previous version from the
                  new version.
 
              3.  A message is sent to the system log file (for example,
                  /usr/spool/syslog on AIX) providing notification that the
                  THRESHOLD was reached.
 
          o   The default value is 15,000 when CMVC_BINARY_THRESHOLD is not
              explicitly set.  In other words, if the size of the differ-
              ence file becomes greater than 15,000 bytes, then the
              threshold processing is invoked.
 
          o   If the size of the difference file exceeds 75% of the size of
              the previous version of the file, then the threshold proc-
              essing is invoked.
 
          o   If CMVC_BINARY_THRESHOLD is set and the size of the differ-
              ence file becomes greater than CMVC_BINARY_THRESHOLD, then
              the threshold processing is invoked.
 
          o   If CMVC_BINARY_THRESHOLD=0 (is set to 0), difference proc-
              essing is skipped and the full copy of the previous version
              is left in place.
 
          CMVC_BINARY_THRESHOLD processes "File -checkin" much faster than
          when a difference file is created, but uses more disk space in
          the family account.  Also, subsequent "File -checkout", "File
          -extract", "Release -extract" and "Level -extract" commands run
          more quickly.
 
 
          3.6  WHAT ARE THE SCCS COMMANDS AND HOW ARE THEY USED?
 
          QUESTION:
 
          What are the SCCS commands and how are they used?
 
          ANSWER:
 
          The following is a summary of the SCCS commands used by CMVC.
          For the complete descriptions of these commands, consult your
          operating system documentation.
 
          ADMIN -I  To create an SCCS archive.  CMVC uses this command to
                    create SCCS archives, that is, s.NN or s.binary files.
                    You can use this command to create an archive when
                    there is a problem with the first version of a file or
                    the entire archive is corrupted.
 
 
          20  CMVC FAQ: version control
 
 
          ADMIN -H  To see if the checksum of an SCCS archive is bad.  CMVC
                    does not use this command.  You can use this command
                    when an error message indicates possibly corrupted SCCS
                    archive.
 
          ADMIN -Z  To recompute the checksum of an archive.  CMVC does not
                    use this command.  You can use this command when trying
                    to solve a corruption problem with an SCCS archive.
 
          DELTA     To check file changes directly into an SCCS archive.
                    CMVC uses this command to check in new versions of a
                    file.  This command also removes the SCCS lock file.
                    You can use this command when the database knows of a
                    new version of a file, but that version is not checked
                    into the SCCS archive.
 
          GET       To extract a specific version of a file into the
                    current directory.  CMVC uses this command during "File
                    -extract", "Release -extract" and "Level -extract".
                    You can use this command when comparing contents of a
                    version of a file with a version extracted using CMVC.
 
          GET -E    To check out a version of a file from an SCCS archive
                    directly into the current working directory.  CMVC uses
                    this command to create an SCCS lock when you check out
                    a file.  You can use this comand when a lock is present
                    in the database, but not in the SCCS archive.
 
          PRS       To display the change history of an SCCS archive.  CMVC
                    uses this command to verify the change history before
                    any updates to a file.  You can use this command to
                    compare the file's change history as stored in the
                    database with that of the SCCS archive.
 
                    NOTE:  Branches in the change history (for example,
                    1.3.1.1) indicate that multiple releases point to the
                    file (that is, they are common) and that links have
                    been broken.
 
          RMDEL     To remove a version from an SCCS archive.  CMVC uses
                    this command during a "File -undo".  You can use this
                    command when a version of a file is not known to the
                    database, but is already checked into the SCCS archive.
 
          UNGET     To remove a lock from an SCCS archive.  CMVC uses this
                    command during a "File -unlock".  You can use this
                    command to remove the SCCS lock when the database does
                    not know a file is locked.  In other words, remove p.NN
                    or p.binary when there is no record in the database
                    FilesOut table.
 
 
                                                          SCCS and CMVC  21
 
 
          22  CMVC FAQ: version control
 
 
                               4.0  FREQUENTLY ASKED QUESTIONS BY END USERS
 
 
          4.1  HOW TO RECLAIM SPACE BY DELETING SCCS ARCHIVE FILES
 
          QUESTION:
 
          How to reclaim space by deleting SCCS archive files
 
          ANSWER:
 
          CMVC families can become very large, mostly from the many ver-
          sions of each file stored in the vc tree.  It is often desirable
          to reclaim some of this space from the vc tree.  Here are two
          methods:
 
          1.  Use the CMVC File -destroy command or the cmvcarchive command
              to remove records from the CMVC database; however, the SCCS
              archive files are not removed by these commands.
 
              See 4.1.1, "Process to remove records of files from the data-
              base" for details.
 
          2.  Remove the SCCS archive files that are no longer referenced
              by database records.
 
              See 4.1.2, "Process to delete unreferenced SCCS archive
              files" on page 24 for details.
 
 
          4.1.1  Process to remove records of files from the database
          ___________________________________________________________
 
          QUESTION:
 
          Process to remove records about files from the database.
 
          ANSWER:
 
          The CMVC "File -destroy" and/or the "cmvcarchive" command remove
          records from the CMVC database.
 
          The process in 4.1.2, "Process to delete unreferenced SCCS
          archive files" on page 24 will allow you to identify and delete
          SCCS archives after using "cmvcarchive" and "File -destroy".
 
          o   "cmvcarchive" provides an option to delete SCCS archives and
              the database records for levels of a release, or releases.
              As a result, cmvcarchive can be used to just save space, or
 
 
                                Frequently asked questions by end users  23
 
 
              to split a family into several families.  However, running
              cmvcarchive can be very time consuming, so levels and
              releases that are no longer used are often left in a family.
              See 4.4, "What are the Archive and Restore limitations for
              versioning?" on page 30 for more details.
 
              Normally, the cmvcarchive command is used to delete a group
              of closely related releases.  This results in deleting all
              records in the database for the specified releases, as well
              as all files in the vc tree that are not referenced by other
              releases.
 
              In cases where other releases contain common files in an SCCS
              archive, the vc tree is pruned so that all versions that are
              unique to the releases being archived are removed.
 
          o   Files can be removed from the family using the "File
              -destroy" command.  While "File -destroy" removes database
              records that point to SCCS archive files, "File -destroy"
              typically does NOT delete SCCS archive files.
 
              So, over time unreferenced SCCS archives may accumulate in a
              family.  You can run the following commands after a "File
              -destroy" in order determine if it is now safe to delete the
              file from the vc tree:
 
              1.  "select id from Versions where sourceId=$X"
 
              2.  "select id from Files where sourceId=$X"
 
              3.  If neither query returns records, you may delete the
                  archive file.
 
              NOTE:  Always perform a family backup prior to deleting any
              archive files.
 
 
          4.1.2  Process to delete unreferenced SCCS archive files
          ________________________________________________________
 
          QUESTION:
 
          Process to delete unreferenced SCCS archive files.
 
          ANSWER:
 
          This is our recommendation for a process to identify and delete
          SCCS archive files after insuring that they are not referenced by
          the CMVC database.
 
          1.  You need to do this from the CMVC family account, although it
              is possible to run the queries from a user account.
 
 
          24  CMVC FAQ: version control
 
 
          2.  Integrity checking is necessary because the tables are NOT
              fully normalized for the sourceId field which is located in
              both the Files and the Versions tables.
 
              a.  The directory and file location of each archive file in
                  the vc tree is stored in the SOURCEID field of the Files
                  table and FileView view.  The directory numbers are con-
                  catenated with the NN from s.NN, b.NN.  Here is an
                  example:
 
                      "$HOME/vc/0/1/2/3/s.45" would be stored as
                      "sourceId=12345"
 
              b.  Since different releases may point to different versions
                  of an SCCS archive, the value of the VERSIONSID (version
                  number used by the archive) may differ.
 
              c.  The following is an integrity check for the Versions
                  table:
 
 
          +---------------------------------------------------------------+
          |                                                               |
          |       Select v.id from Versions v                             |
          |       where v.sourceId not in                                 |
          |       (select f.sourceId from Files f)                        |
          |                                                               |
          +---------------------------------------------------------------+
          Figure 2. Check Versions table for sourceId not in the Files
                    table
 
 
              d.  The following is an integrity check for the Files table:
 
 
          +---------------------------------------------------------------+
          |                                                               |
          |       Select f.id from Files f                                |
          |       where f.sourceId not in                                 |
          |       (select unique v.sourceId from Versions v)              |
          |                                                               |
          +---------------------------------------------------------------+
          Figure 3. Check Files table for sourceId not in Versions table
 
 
                                Frequently asked questions by end users  25
 
 
          3.  The following will check for a SOURCEID (assuming we passed
              the integrity checks):
 
 
          +---------------------------------------------------------------+
          |                                                               |
          |       #!/usr/bin/ksh                                          |
          |       # $1 = name of family                                   |
          |       # $2 = path of a file in vc tree                        |
          |       #     (for example, 1/2/3/4/s.56)                       |
          |       #                                                       |
          |       cd ${HOME}/vc                                           |
          |                                                               |
          |       # Verify that file exists                               |
          |       if µµ !-d ${2} -a !-f $2 ºº                             |
          |       then                                                    |
          |          print -u2 "Error file $2 is not in vc tree"          |
          |          exit 1                                               |
          |       fi                                                      |
          |                                                               |
          |       # Convert Path to file into a sourceId                  |
          |       SourceId=`$2 | tr -d "/s."`                             |
          |                                                               |
          |       # NOTE:  Where the ` symbol is the accent grave,        |
          |       # in the upper left corner in the English keyboard.     |
          |                                                               |
          |       # Connect to family and search for any                  |
          |       # occurrences of sourceID                               |
          |       db2 connect to $2                                       |
          |       db2 "select p.name, r.name, v.SID                       |
          |       from Files f, Releases r, Path p, Versions v            |
          |       where (f.versionId=v.id or f.nuVersionId=v.id)          |
          |       and f.releaseId=r.id and f.pathId=p.id and              |
          |       f.versionID=v.id and                                    |
          |       f.sourceId=${SourceId}" > tmpfile                       |
          |                                                               |
          |       # Find DB2/6000 count of records returned               |
          |       let x=`grep 'record(s) selected' tmpfile | \            |
          |       awk '{ print $1 }'`                                     |
          |       if (( $x == 0 ))                                        |
          |       then                                                    |
          |          # Delete file if not referenced in database          |
          |          # (either file or directory)                         |
          |          rm -rf $2                                            |
          |       end                                                     |
          |                                                               |
          |       # Disconnect from family                                |
          |       db2 connect reset                                       |
          |                                                               |
          +---------------------------------------------------------------+
          Figure 4. Check Files and Versions table for a specific sourceId
 
 
          4.  Since versions are sequential, it is possible to find the
              last file in the vc tree, then loop from 1 through that
 
 
          26  CMVC FAQ: version control
 
 
              number (for example, 12345) using the above query to find
              files to delete.
 
              It is also possible to use "order by sourceId" on a query and
              take the last entry (or do both).
 
 
          4.2  ARE THERE PREVENTIVE MEASURES TO AVOID SYNCHRONIZATION
          PROBLEMS?
 
          QUESTION:
 
          Are there preventive measures to avoid synchronization problems?
 
          ANSWER:
 
          You can periodically check for some problems that can occur with
          SCCS.  The following procedures are most beneficial when run
          before a backup:
 
          o   See 4.2.1, "Finding SCCS and database lock problems early."
          o   See 4.2.2, "Finding corrupted SCCS archive files early" on
              page 28.
 
 
          4.2.1  Finding SCCS and database lock problems early
          ____________________________________________________
 
          QUESTION:
 
          Finding SCCS and database lock problems early.
 
          ANSWER:
 
          An indication that SCCS has a lock on a file, but the database
          does not, is that there are multiple entries in a p.NN file for
          the same current version.  Here is a shell script to locate such
          problems:
 
 
                                Frequently asked questions by end users  27
 
 
          +---------------------------------------------------------------+
          |                                                               |
          |       #!/usr/bin/ksh                                          |
          |       # Find all lock files and check for multiple            |
          |       # locks against the same current version                |
          |       # of the file (an error)                                |
          |       find $HOME/vc -name p.* -exec wc -l {} \; > tmpfile     |
          |       let count=0                                             |
          |       while read count path                                   |
          |       do                                                      |
          |          # Only check lock files with multiple entries        |
          |          if (( $count > 1 ))                                  |
          |          then                                                 |
          |             # Check for multiple locks on the same            |
          |             # current release                                 |
          |             x=`cut -d' ' -f1 $path | uniq -d`                 |
          |             if µµ $x != "" ºº                                 |
          |             then                                              |
          |                print "Error found in file $path, \            |
          |                  multiple locks on version $x"                |
          |             fi                                                |
          |          fi                                                   |
          |       done < tmpfile                                          |
          |       rm tmpfile                                              |
          |                                                               |
          +---------------------------------------------------------------+
          Figure 5. Korn shell sample to find bad SCCS file locks.  Find
                    all lock files and check for multiple locks against the
                    same current version of the file (an error).
 
 
          4.2.2  Finding corrupted SCCS archive files early
          _________________________________________________
 
          QUESTION:
 
          Finding corrupted SCCS archive files early.
 
          ANSWER:
 
          It is best if you can find all damaged SCCS archives before they
          are backed up and become something you must rely on.  This means
          trying to find and correct the problem before incremental backups
          and before a system failure occurs.  Below are two simple com-
          mands that can be run prior to issuing a backup:
 
            find $HOME/vc -name "s.*"        -exec admin -h {} \;
 
          The above command will only report errors.  To see the progress
          of the command use:
 
 
          28  CMVC FAQ: version control
 
 
            find $HOME/vc -name "s.*" -print -exec admin -h {} \;
 
 
          4.3  CAN I CONTROL THE VERSION NUMBERS FOR FILES?
 
          QUESTION:
 
          We have one release "release-a" and the file versions are of the
          form 1.1, 1.2. etc.  Then we linked the release to "release-b"
          and break the link.  Now the file versions in this release are of
          the form 1.1.1.1, 1.2.1.1.
 
          The developers do not like to see 1.1.1.1, 1.2.1.1 version
          numbers in release-b, they want to have 1.1, 1.2 version numbers.
 
          Is it possible to control the explicit sequencing for the version
          numbers of the files?
 
          ANSWER:
 
          The short answer is NO; CMVC controls the version numbering.
          Your programmers should only be concerned with the Release, Level
          and Track that they are working on.  If they need historical data
          use:
 
            File -view -long
 
          The numbers themselves are essentially meaningless!  Further, the
          only way to see why the version numbers changed as they did is to
          look at the Release and Track change histories.
 
          That said, the better your programmer's understand what to
          expect, the more comfortable they will be with these numbers.
          Here is an example to show how releases and file changes impact
          the version numbers for SCCS:
 
          o   When you create a file in CMVC in release-a, the version id
              from SCCS is 1.1; this is also known as SID, which is used in
              the tables and views shown in Chapters 6 and 7 of the CMVC
              Users Manual.
 
          o   If you then link a file into release-b, then the version id
              (SID) of the file in release-b becomes 1.1 too.  So far so
              good.
 
          o   However, if you checkout the file and break the link, then
              the release that was used when the link was broken, is the
              release that will keep the version id of 1.x.  The other
              release will use 1.1.1.x.  Thus, the sequence of the
              checkout/check-in/break-link is important.
 
          Let's see a real example:
 
 
                                Frequently asked questions by end users  29
 
 
          RELEASES  rel-a and rel-b
          TRACK     2 tracks are open for each release
          FILE      test.txt
 
          1.  File is created with rel-a (SID 1.1).
          2.  File is linked to rel-b (SID 1.1 for both releases).
          3.  File is checked-out.
          4.  File is checked-in using rel-a as the primary release and the
              link is broken.  File in rel-a will have SID 1.2, and file in
              rel-b still has SID 1.1
          5.  File in rel-b is checked-out and checked-in, and now its SID
              is 1.1.1.1.  At this stage we have:
 
                   file in rel-a: SID 1.2
                   file in rel-b: SID 1.1.1.1
 
 
          TEAMCONNECTION NOTE:  TeamConnection uses a numbering scheme that
          is based exclusively on the versioned objects within the family,
          for example, Release, Driver, WorkArea and Part.  While there are
          several new concepts to learn as well as name changes for objects
          (that is, Level becomes Driver, Track becomes WorkArea, and File
          becomes Part), the versioning scheme is now consistent with the
          change history.
 
 
          4.4  WHAT ARE THE ARCHIVE AND RESTORE LIMITATIONS FOR VERSIONING?
 
          QUESTION:
 
          What are the Archive and Restore limitations for versioning?
 
          ANSWER:
 
          Below are limitations of the cmvcarchive command beyond what is
          documented in CMVC Server Administration and Installation,
                        ____________________________________________
          Version 2 Release 3:
          ___________________
 
          1.  There is a limitation to the "delete objects" option of
              cmvcarchive:
 
              o   SCCS archive files can only be deleted when ALL
                  levels/releases that reference the archive file are
                  included in the list provided to cmvcarchive when
                  prompted.
              o   SCCS archive files are deleted in their entirety.  There-
                  fore, the archive file can only be deleted when all ref-
                  erences to the file are deleted (that is, all
                  levels/releases must be deleted).
 
 
          30  CMVC FAQ: version control
 
 
          2.  When archiving multiple releases or levels the
              releases/levels should be specified in order from most to
              least recently completed.
 
          3.  When typing a long list of releases/levels into cmvcarchive,
              it is possible to become input inhibited due to the limita-
              tion of 1024 characters per line in the command shell.  To
              overcome this limitation, type your responses to the
              cmvcarchive commands into a file and run cmvcarchive as
              follows:
 
                cmvcarchive < response.file
 
              A sample response file might look like:
 
                2                 - perform an archive
                2                 - archive releases
                release1 release2 - releases to be archived
                2                 - delete the release after archive
                2                 - confirm delete
                1                 - archive to directory in local file system
                /home/fam/archive - specify the archive directory
 
              NOTE:  Do not include comments in your response file, they
              are shown here only to add clarity to the example.
 
          4.  Selecting the delete option can often DOUBLE the amount of
              required processing time.
 
              If it becomes necessary to terminate a cmvcarchive process
              after it has begun deleting objects, it must be restored from
              a backup.  If this should occur, the user is warned to
              restore from backup.
 
 
          4.5  WHY IS THERE A LINE LENGTH LIMIT FOR TEXT FILES?
 
          QUESTION:
 
          I cannot create or check in a text file that has more than 510
          bytes per line without the file being converted to "binary".  The
          warning message blames SCCS, is this right?
 
          ANSWER:
 
          SCCS is the limiting factor.  SCCS is old, with many limitations,
          but is also available on all Unix operating systems and familiar
          to most system administrators.  As such, it was selected as the
          default versioning mechanism for CMVC.
 
          Here are the SCCS limitations that CMVC must live with:
 
 
                                Frequently asked questions by end users  31
 
 
          o   SCCS imposes a line length limit of 510 (not 512) for text
              files.
          o   SCCS only stores text files.
          o   Binary files are stored in the native file system.
 
          Based on the above limitations from SCCS, you can understand
          better the behavior that you see from CMVC:
 
          o   File creation
 
              When you create a file within CMVC you have the option to
              tell the CMVC server whether the file is binary or not.
 
              If you supply the -binary flag on a file create command, the
              CMVC server will store the file in the native file system.
 
              If you do not specify the -binary flag, the CMVC server ini-
              tially considers the file as 'text'.
 
              However, due to the SCCS line length limitation, and the fact
              that users could have forgotten to supply the -binary flag,
              the CMVC server verifies the contents of the file.  If it
              finds a binary signature on the file or a line length
              exceeding 510 characters, the CMVC server will switch the
              file type to binary and store it in the native file system.
              Note that only the type of the file is switched.  The con-
              tents of the file are not modified.
 
          o   File check-in
 
              The server only decides upon creation time where it will
              store the file.  If subsequent checkins break the rules of
              SCCS, there is no provision in the current design to switch
              the files to the native file system.  Therefore, if the
              maximum size of a line in a text file is now exceeded, then
              the CMVC server will report an error (because it cannot
              change the type of a file from text to binary).
 
          Some workarounds to cope with the problem are:
 
          1.  Ensure that text file does not exceed 510 bytes per row.
 
          2.  If option 1 cannot be done, then it is necessary to delete
              the file, and recreate it as binary.
 
          TEAMCONNECTION NOTE:  TeamConnection has developed its own mech-
          anism for storing file data in the database, along with all of
          the rest of the state data necessary to perform version control
          and configuration management.  As a result, TeamConnection does
          not have any such limitations for text files.  You can even
          change a file from "text" to "binary" and back without difficulty
          or penalty.
 
 
          32  CMVC FAQ: version control
 
 
          4.6  HOW TO FIND OUT THE FILE NAME IN THE VC TREE (REVERSE
          VCPATH)
 
          QUESTION:
 
          A file cannot be extracted because a message says that the file
          was damaged.  The message included the rather cryptic name of the
          file in the vc directory structure of the CMVC family.
 
          How do you find out the real name of a file under CMVC control,
          given the cryptic name of the file in the vc tree?
 
          ANSWER:
 
          1.  If you have the full pathName of the s.file in the CMVC
              server repository (the vc directory structure), such as
              $HOME/vc/0/1/2/3/s.45, then you obtain the sourceID by con-
              catenating all the integers that appear in the vc subdirecto-
              ries and the file name, from left to right:
 
                s.file name:                $HOME/vc/0/1/2/3/s.45
                                                     | | | |   ||
                concatenating the integers:          0+1+2+3+  45
                                                     | | | |   ||
                                                     |++ | |   ||
                                                     ||  | |   ||
                                                     ||+++ |   ||
                                                     |||   |   ||
                                                     |||++++   ||
                                                     ||||      ||
                                                     ||||++++++++
                                                     ||||||
                CMVC sourceID:                       012345
 
          2.  Once you have the sourceId, you can issue the following query
              to obtain the fileName:
 
                   Report -view FileView -where "sourceId=12345"
 
              This query may give multiple entries where the fileName is
              always the same but the releaseName and SID (Version ID)
              differ.
 
 
                                Frequently asked questions by end users  33
 
 
          34  CMVC FAQ: version control
 
 
                                    5.0  ERROR RECOVERY: GENERAL PROCEDURES
 
 
          5.1  WHY DO SCCS/DATABASE SYNCHRONIZATION PROBLEMS OCCUR IN CMVC?
 
          QUESTION:
 
          Why do SCCS/database synchronization problems occur in CMVC?
 
          ANSWER:
 
          In CMVC, the database and SCCS can become out-of-sync when a CMVC
          command performs a file operation (for example, "File -checkin")
          and the SCCS action completes successfully, but there is a
          problem with the database and the data is not committed (database
          transaction rollback).
 
          In other words, the database does not get updated, but the SCCS
          system does.  When this occurs, the user generally receives a
          generic error message, then has trouble with subsequent CMVC com-
          mands that operate on the same file.
 
          Here are some scenarios that have caused out-of-sync errors
          within CMVC:
 
          o   The family account runs out of available processes after com-
              pleting the SCCS transaction, but before the entire command
              is complete.
 
          o   The user enters <Ctrl-C> to terminate a "File -checkin" after
              the SCCS transaction is complete, but before the entire
              command is complete.
 
          o   The database experiences an error (for example, filling up
              the transaction log file) during a File command, but after
              the SCCS portion is complete.  The database portion is rolled
              back.
 
          o   There is a collision between transactions accessing the same
              data record in a table and the database transaction rolls
              back.
 
          A typical error that involves an SCCS/database out-of-sync
          problem will look like this:
 
 
                                     Error recovery: general procedures  35
 
 
            0010-511 An error occurred when the CMVC server software tried to
               get file /u/flowmark/vc/0/0/0/2/s.70.
               Contact the family administrator for assistance.
            0010-025 An error occurred when the CMVC server software tried to
               extract files from the version control file repository.
            0010-436 The extraction of release fm_test cannot be completed.
 
          In the above example, the error identifies a specific file in the
          vc directory of the flowmark family as having a problem during a
          "Release -extract".  The fact that a directory in the vc tree was
          identified in the error message is a sufficient indication that
          there is a synchronization problem between SCCS and the database
          used by CMVC.
 
 
          5.2  GENERAL SYSTEM PROBLEMS THAT IMPACT THE VERSIONING IN CMVC
 
          QUESTION:
 
          What are the general system problems that impact the versioning
          function in CMVC?
 
          ANSWER:
 
          Before checking for a specific database/SCCS problem (see 5.4,
          "Procedure to diagnose a versioning problem in CMVC" on page 38),
          there are some general system constraints to check:
 
          1.  Make sure there is sufficient space in /tmp.
 
              If there are large binary files in the family, make sure that
              there is at least three times the size of the largest file
              available in /tmp.
 
          2.  If you are using a database that accumulates a transaction
              log, make sure the file system containing your database is
              not full.  Also, some databases set explicit limits on the
              size of a log.
 
          3.  If the problem occurred during a "Release -extract" or "Level
              -extract", try to extract the file that caused the failure.
              See 4.1, "How to reclaim space by deleting SCCS archive
              files" on page 23 for instructions on using the information
              in the error message; for example, identify the file associ-
              ated with "/u/flowmark/vc/0/0/0/2/s.70" in the release you
              were extracting.
 
          4.  For "Release -extract" or "Level -extract", if you have a
              history of network problems, try using the "nomount" option
              on "Release -extract" or "Level -extract" to see if the file
              will extract to the server machine without NFS involved.
 
 
          36  CMVC FAQ: version control
 
 
          5.  Check the contents of syslog.
 
              In AIX, also run the errpt command.  Locate any potentially
              related errors.
 
 
          5.3  PREPARING TO MAKE A FIX TO A VERSIONING PROBLEM
 
          QUESTION:
 
          Preparing to make a fix to a versioning problem
 
          ANSWER:
 
          Before making a change to an SCCS archive, keep the following in
          mind:
 
          o   Whenever possible, it is better to restore from a backup than
              to work with a corrupted SCCS archive or binary delta file.
 
          o   You are looking for the minimum necessary change in order to
              get the SCCS archive to contain the same version information
              as the database.
 
          o   Copy each file you intend to modify (for example, s.NN and
              p.NN) to another directory before trying.  This will allow
              you to restore these backup files in case of mistake.
 
          o   In cases where there are branches in the SCCS archive history
              (for example, 1.2.1.1), you will need to specify the revision
              you are working to update.  Examples in 6.0, "Error recovery:
              specific scenarios" on page 41 all use "-rDESIRED_VERSION" to
              identify the version of the file to be updated.  If it is not
              necessary (that is, if there are no branches), you may omit
              it.
 
          o   Use the SCCS "prs" command after your changes to make sure
              that the SCCS archive has been updated properly.
 
          o   After you have verified your changes, clean up your temporary
              files.
 
          o   Make sure a backup is done soon after you have successfully
              eliminated your problems.
 
 
                                     Error recovery: general procedures  37
 
 
          5.4  PROCEDURE TO DIAGNOSE A VERSIONING PROBLEM IN CMVC
 
          QUESTION:
 
          What is the procedure to diagnose a versioning problem in CMVC?
 
          ANSWER:
 
          Once you have eliminated a system problem (see 5.2, "General
          system problems that impact the versioning in CMVC" on page 36),
          you will need the following information to correct your problem:
 
          1.  Stop the family and the database.
 
              There might be hung transactions waiting for a chance to
              rollback.
 
              Also consider rebooting.  In some cases, this clears up the
              problem.
 
          2.  Restart the database and family, then verify that the problem
              still exists.
 
          3.  Find out where the SCCS archive file is in the vc tree using
              the "vcPath" tool which is documented in CMVC Server Adminis-
                                                       ____________________
              tration and Installation, Version 2 Release 3 .
              _____________________________________________
 
              The vcPath query is:
 
 
          +---------------------------------------------------------------+
          |                                                               |
          |       select sourceId, type from FileView                     |
          |       where pathName = 'PATH/FILE' and \                      |
          |             releaseName = 'RELEASE'                           |
          |                                                               |
          +---------------------------------------------------------------+
          Figure 6. SCCS archives of all files of the name PATH/FILE.  A
                    database query that will return the location of all
                    SCCS archives for files with a specific PATH/FILE name
                    in all releases.
 
 
          4.  What is the file type: text, special, binary, long, longSp?
 
          5.  It is possible for an SCCS archive to be referenced by files
              in multiple releases; further, the path/file may be different
              in another release.
 
              Files in different releases that point to the same SCCS
              archive are referred to as COMMON.  Determine which
              file/release combinations point to this SCCS archive or
 
 
          38  CMVC FAQ: version control
 
 
              directory in the vc tree.  In the example, you could substi-
              tute "sourceId=12345" for VCFILE in order to search for all
              releases that have a file pointing to the SCCS archive
              vc/0/1/2/3/s.45.
 
 
          +---------------------------------------------------------------+
          |                                                               |
          |       select pathName, releaseName, sourceId, type \          |
          |       from   FileView  where sourceId=VCFILE                  |
          |                                                               |
          +---------------------------------------------------------------+
          Figure 7. Files common to an SCCS archives.  A database query
                    that will locate the file in each release that refer-
                    ences a specific SCCS archive.
 
 
          6.  Compare the lock status of the SCCS archive to the database.
              You can use the command line or GUI.  There is no need to use
              database queries.
 
              To view the contents of the p.NN file, use "cat p.NN" This
              will show the contents of the p.NN file to see what versions
              of the SCCS archive are locked.  If there is no p.NN file,
              the SCCS archive does not have any locks.  This also applies
              to p.binary.
 
              Use the CMVC Report or File commands to determine if the
              database has a lock on the file.
 
          7.  Determine if the SCCS archive file can be read:
 
              The SCCS command to check for a corrupt archive is:  "admin
              -h s.NN"
 
              For a binary file the command is:  "admin -h s.binary"
 
              Some CMVC users periodically check all SCCS archive files to
              insure that no corruption has occurred.  See 4.2.2, "Finding
              corrupted SCCS archive files early" on page 28 for the proce-
              dure.
 
          8.  Check the history of the file:  "prs s.NN" or "prs s.binary"
 
              "prs" returns the complete list of versions of a file for all
              releases that point to it.  Newest versions of the file are
              listed first.  "Report -view FileView" or "File -view" will
              display all of the versions of a file represented in the
              database.
 
              Compare the history information from the SCCS archive and
              database to locate discrepancies.
 
 
                                     Error recovery: general procedures  39
 
 
          5.5  HINTS ON DEBUGGING VERSION CONTROL PROBLEMS
 
          QUESTION:
 
          Hints on debugging version control problems
 
          ANSWER:
 
          If you are experiencing a problem when creating, checking in or
          checking out files from the CMVC server and you can not seem to
          solve the problem, try the native SCCS or PVCS commands to narrow
          down the problem.
 
          o   Using SCCS version control commands.
 
              -   Logon to the family's account.
              -   Create a test file (such as test.c)
              -   Give the file to SCCS: admin -itest.c s.test.c
              -   Try to checkout the file: get -e s.test.c
              -   Try to checkin the file: delta s.test.c
 
          o   Using PVCS version control commands:
 
              -   Logon to the PVCS account
              -   Create a test file (such as test.c)
              -   Give the file to PVCS: vcs -i test.c
              -   Try to checkin the file: put -r1.1 test.c
              -   Try to checkout the file: get -l -r1.1 test.c
              -   Try to checkin the file again: put -r1.2 test.c
 
 
          40  CMVC FAQ: version control
 
 
                                    6.0  ERROR RECOVERY: SPECIFIC SCENARIOS
 
 
          The following are typical scenarios where you would use SCCS com-
          mands to correct the problem of the database and SCCS being out
          of sync.
 
          Before you attempt to fix a versioning problem mentioned in this
          section, please see 5.0, "Error recovery: general procedures" on
          page 35 for the general procedures to follow.
 
 
          6.1  SCCS ARCHIVE HAS A FILE LOCK, BUT THE DATABASE DOES NOT
 
          QUESTION:
 
          SCCS archive has a file lock, but the database does not
 
          ANSWER:
 
          When the SCCS archive has a corresponding p.NN file, but a CMVC
          database has no lock record in the FilesOut table, use the fol-
          lowing to remove the lock from the SCCS archive:
 
            unget -rDESIRED_VERSION s.NN
 
          NOTES:
 
          1.  This will delete the p.NN or p.binary file if there is only 1
              line in the file.
 
          2.  It is possible for a file to be locked by multiple releases,
              in which case the line containing information on the version
              locked in the affected release will be deleted.
 
 
          6.2  UNABLE TO CHECKOUT A LOCKED FILE WITH FORCE OPTION
 
          QUESTION: A user already has checked out a file that is common
          between 3 releases:
 
            New Path Name      Release Current Committed Locked by
            -------------      ------- ------- --------- ---------
            admin/admincmd.doc dmb_10  1.4     1.4       xyz
            admin/admincmd.doc dmb_12  1.4     1.4
            admin/admincmd.doc dmb_31  1.4     1.4
 
          The file is common to all three releases and locked in the first
          release.  The user is trying to check-out the file from the third
 
 
                                     Error recovery: specific scenarios  41
 
 
          release by using the 'force' option and gets the following
          message:
 
             0010-682 An error occurred in SCCS when the CMVC server software
                      tried to check out file admin/admincmd.doc.
 
                      The version control failed to create a lock for
                      this file within the version control file tree.
 
          ANSWER:
 
          It is recommended to perform the following actions:
 
          1.  Identify the location of the lock for that file, in this case
              it is a p.binary.
 
          2.  Make a backup copy of the p.binary, just in case.
 
          3.  Use the SCCS command:
 
                unget -r1.4.1.1 s.binary
 
          4.  Use File -unlock -release dmb_10
 
          5.  Verify that p.binary is gone and that no locks show for the
              file.
 
          6.  Verify everything is correct by checking the file out again.
 
 
          6.3  THE DATABASE HAS A LOCK RECORD, BUT THE SCCS ARCHIVE DOES
          NOT
 
          QUESTION:
 
          The database has a lock record, but the SCCS archive does not.
 
          ANSWER:
 
          If the CMVC database has a lock record in the FilesOut table, but
          there is no corresponding p.NN file for the SCCS archive, then
          use the following to create one:
 
            get -e -rDESIRED_VERSION s.NN
 
          NOTES:
 
          1.  If CMVC shows a branch in the path, it may be necessary to
              use the "-b" option to force a branch.
 
          2.  The file will be checked out as NN in the current working
              directory.
 
 
          42  CMVC FAQ: version control
 
 
          6.4  ONE VERSION OF A FILE IS NOT IN CMVC
 
          QUESTION:
 
          One version of a file is not in CMVC
 
          ANSWER:
 
          If a version of a file is in an SCCS archive, but there is no
          record in the Versions table in CMVC, use the following to remove
          the version from the SCCS archive:
 
            rmdel -r VERSION_TO_BE_REMOVED s.NN
 
          NOTES:
 
          1.  It is possible for a file in multiple releases to point to
              the same version of a file (that is, "File -link" has been
              used).
 
          2.  Verify that deleting a version will not delete a file pointed
              to by another release.  See 4.1, "How to reclaim space by
              deleting SCCS archive files" on page 23 for details.
 
 
          6.5  ONE VERSION OF A FILE IS MISSING FROM AN SCCS ARCHIVE
 
          QUESTION:
 
          One version of a file is missing from an SCCS archive
 
          ANSWER:
 
          If a version of a file is in the Versions table of the CMVC data-
          base, but missing from the SCCS archive, the procedures below
          will add a file to SCCS.  However, it is recommended that, when
          possible, you add them temporarily, use CMVC to undo the changes,
          then use CMVC to make updates to the database and SCCS together.
 
 
          6.5.1  Missing from type text and special files
          _______________________________________________
 
          1.  Check out the file:  "get -e -rDESIRED_VERSION s.NN"
 
              The file will be checked out as NN in the current working
              directory.
 
          2.  Copy the version of the file you want checked in into the
              current working directory as NN; that is, replace the current
              NN file with your new version.
 
 
                                     Error recovery: specific scenarios  43
 
 
              NOTE:  In the case of a type SPECIAL file, you must remove
              the <Ctrl-Z> first.
 
          3.  Check in the new version:  "delta -rDESIRED_VERSION s.NN"
 
 
          6.5.1.1  Missing from type binary, long and longSp files
 
          1.  Emulate a checkout in the SCCS archive:  "get -e
              -rDESIRED_VERSION s.binary"
 
              Since binary files are not stored in the archive, this will
              create an empty file, binary, in the current working direc-
              tory.
 
          2.  Copy the version of the file you want checked in into the
              current working directory as the name of the version (for
              example, for version 1.6 of a file, copy the file in as 1.6).
 
              NOTES:
 
              a.  For a type LONGSP file, you must remove the <Ctrl-Z>
                  first.
              b.  If the previous version of the file is a delta file (for
                  example, 1.5d) the new file must exactly match the
                  version that was lost.  Otherwise, it will be impossible
                  for CMVC to merge the current version (for example, 1.6)
                  with the delta file (for example, 1.5d).
 
          3.  Set the timestamp on file:  "touch binary"
 
              This is merely a precaution to insure a unique timestamp.
 
          4.  Update the change history of the SCCS archive:  "delta
              -rDESIRED_VERSION s.binary"
 
          5.  If you have delta files that cannot be reconstructed using
              CMVC, but you have copies of the different versions of the
              files outside of CMVC, then you can copy those files into the
              vc tree to replace the delta files.
 
              For example, if file 1.3 is lost and all that remains is 1.3d
              and 1.2d, you cannot recreate versions 1.2 or 1.1.  If these
              files exist outside of CMVC, then delete 1.2d and 1.3d and
              copy the files in as 1.1, 1.2 and 1.3.  CMVC will be able to
              use the full source copies without any problems.
 
 
          44  CMVC FAQ: version control
 
 
          6.6  CORRUPTION OF SCCS ARCHIVE FILE
 
          QUESTION:
 
          Corruption of SCCS archive file
 
          ANSWER:
 
          When a CMVC File operation fails with an error messages such as,
          "Archive corrupted":
 
          o   Use "admin -h" to see if the checksum is bad.  The checksum
              is used to determine if a bad modification has been made to
              an SCCS archive.
 
          o   If the checksum is bad, use "errpt" on AIX to see if there
              have been any hardware or software errors.  "errpt -a" pro-
              vides more details.
 
              -   Compare the timestamp from "errpt" with the timestamp of
                  the archive file to locate the appropriate messages.
 
              -   Determine if it is necessary to replace your current hard
                  disk.
 
          o   Use "admin -z" to recompute the checksum.  Sometimes the only
              problem is the checksum.
 
          o   If the checksum recomputes successfully, use CMVC to verify
              that all of the versions of the file can be extracted and
              appear to be correct.
 
 
          6.7  SCCS ARCHIVE IS DAMAGED BEYOND REPAIR
 
          QUESTION:
 
          SCCS archive is damaged beyond repair
 
          ANSWER:
 
          When the procedure in 6.6, "Corruption of SCCS archive file"
          cannot correct the problem with the SCCS archive, it is necessary
          to create a new archive.
 
 
                                     Error recovery: specific scenarios  45
 
 
          6.7.1  If something of the SCCS archive can be recovered
          ________________________________________________________
 
          1.  Extract each version of the file that is still usable:  "get
              -rDESIRED_VERSION s.NN"
 
          2.  Rename each version from NN to something you can easily
              remember.
 
          3.  Create a new archive using the procedure in 6.7.2, "If the
              entire archive is corrupted."
 
 
          6.7.2  If the entire archive is corrupted
          _________________________________________
 
          If nothing can be extracted, then it is generally best to  do the
          following
 
          1.  Use "File -delete" to delete the record of the file in the
              database.
          2.  Use "File -destroy" to dispose of the file from the version
              control file system
          3.  Use "File -create" to recreate the history with files not in
              CMVC.
 
          In order to destroy a file you need an archive with a history
          that matches the database.  This is how to create a new archive
          with the history you need:
 
          1.  Rename the bad archive: "mv s.NN s.NN.save"
 
          2.  Create a new SCCS archive: "admin -i s.NN"
 
              The admin command will check NN as the first version of the
              file (that is, 1.1).
 
          3.  If you have copies of your old source or the archive is used
              by releases that you cannot update, then follow directions in
              6.5, "One version of a file is missing from an SCCS archive"
              on page 43 for details on copying each version into the
              directory of the SCCS archive and checking the files into the
              archive as the correct version.  If you are missing a few
              versions, you might be forced to put another version in more
              than one place to replace the missing versions.
 
          4.  If it is OK to destroy and create a new file of the same name
              (our recommended process), then reconstruct the SCCS archive
              with empty files.
 
              Once CMVC and SCCS are in sync, destroy the archive and use
              CMVC to create new files in each release.  For each version,
              you will:
 
              GET -E S.NN    To check out a version of the file, NN.
 
 
          46  CMVC FAQ: version control
 
 
              GET -E -B S.NN To check out a version of the file and force a
                             branch.
              TOUCH NN       To update the timestamp of the empty file.
              DELTA S.NN     To check in the file
              PRS S.NN       To check the results of your changes.
 
          NOTE:  Periodically running "admin -h" in conjunction with
          backups should prevent this from occurring.  See 4.2.2, "Finding
          corrupted SCCS archive files early" on page 28 for details.
 
 
          6.8  SCCS GIVES A WARNING MESSAGE WHEN THE SFILE IS MORE THAN 1
          YEAR OLD
 
          QUESTION:
 
          SCCS gives a warning message when the sfile is more than a year
          old.  SCCS has "checked the file out" by updating its lock file
          but CMVC misinterprets the message and thinks it failed.
 
          ANSWER:
 
          The workaround is to do the following:
 
          1.  Get rid of the lock file (such as the "p.43" lock file).
 
          2.  Edit the sfile "s.43" and change the 2-digit year on the
              latest delta line such as "D 1.6  94/11/09", to make the date
              less that one year old.
 
          3.  Run the command "admin -z s.43" to recalculates the checksum
              of the file.
 
 
          6.9  DIFFERENCES IN A FILE BETWEEN CHECKED IN VERSION AND THE
          EXTRACTED ONE
 
          QUESTION:
 
          In the following situations, we have seen differences between the
          version of a file that was checked in and the version that is
          immediately extracted:
 
          o   If the file contains a text line without CR/LF (carriage
              return + line feed), then CMVC is adding a CR/LF to this
              line.
 
          o   If the file contains an empty line without CR/LF, then CMVC
              removes the line.
 
          ANSWER:
 
 
                                     Error recovery: specific scenarios  47
 
 
          It sounds as if your customer needs to set the CRLF to 'on' in
          the options settings window.
 
          It is important to know that carriage returns are not needed on
          the UNIX server and when you check the files in and out you are
          constantly removing and adding the carriage return back onto the
          file.
 
          The default of 'on' is the best option because then the system
          does it for you.
 
          Also if you want a blank line in the file you need to end it with
          a carriage return or the system does not recognize it.
 
 
          6.10  MESSAGE: BINARY DELTA UNSUCCESSFUL, IT HAS REACHED THE
          THRESHOLD LIMIT
 
          QUESTION:
 
          I tried to check in a binary file into CMVC and after around 20
          minutes I got this message on the console:
 
            Binary delta unsuccessful, it has reached the threshold limit.
            The complete binary file has been stored to
            the version control repository.
 
          What does it mean? Is the file OK?
 
          ANSWER:
 
          Since CMVC 2.3.0.14 (or later) we have fixed a problem with the
          treatment of the threshold for binary files.
 
          There is an environment variable in the CMVC server
          (CMVC_BINARY_THRESHOLD, documented in the CMVC Server manual,
          Version 2, page 39) that can be used to save time when creating
          new versions of files by limiting the size of a difference file
          used when computing a delta for binary files.
 
          For more details see 3.4, "Files that are only partially stored
          in SCCS archive files" on page 17.
 
          For example, if the mentioned variable is set to 15,000 bytes
          (export CMVC_BINARY_THRESHOLD=15000) this means that CMVC will
          try to create a binary delta if it finds less than 15,000 bytes
          of differences, however if it finds 15,001, then CMVC will stop
          the attempt and will display the information message that you saw
          and store the entire binary file instead of a delta file.
 
          For more details see 3.5, "How is the CMVC_BINARY_THRESHOLD vari-
          able used?" on page 19.
 
 
          48  CMVC FAQ: version control
 
 
          6.11  GETTING A STRANGE ERROR WHEN EXTRACTING AN INVALID VERSION
          NUMBER
 
          QUESTION:
 
          The latest version of a file is 1.3.  When trying to extract
          version 1.4 (which does not exist yet) a strange error message is
          shown.  All valid versions can be extracted successfully without
          any errors, though.
 
            get: The specified SID is not valid
                 Use the sact command to check the p-file for valid SID numbers.
 
          Could you explain this error message?
 
          ANSWER:
 
          Let's see the following scenarios using a committed file and an
          uncommitted file, when a non existent version is specified to be
          extracted:
 
          1.  Scenario 1: A committed file has versions 1.1, 1.2 and 1.3.
 
              o   Extraction of 1.3: good, as expected.
 
              o   Extraction of 1.0 or 1.4 (non-existent):
 
                         get: The specified SID is not valid
                              Use the sact command to check the p-file for valid SID numbers.
                         0010-511
                         0010-044
 
          2.  Scenario 2: An uncommitted file has versions 1.1, 1.2 and
              1.3.
 
              Same behavior for all the cases as in Scenario 1.
 
 
          6.12  HOW TO DEAL WITH THE ERROR 0010-781
 
          QUESTION:
 
          I got the following error message when trying to checkin a file:
 
            0010-781 The CMVC server has determined there is inadequate
                        file space to receive a file of size XXXX bytes.
 
          ANSWER:
 
 
                                     Error recovery: specific scenarios  49
 
 
          A file is temporarily stored in /tmp on the CMVC server before it
          is checked into the CMVC server.
 
          The /tmp directory on the server must be large enough to hold 2
          times the size of the SCCS archive (s.XX) file for a SCCS or PVCS
          delta file.
 
          If this file is binary (that is, non-ascii characters, long lines
          or you selected binary), make sure you have 3 times the size of
          the file in /tmp on the server.
 
          Remember that more than one user can simultaneously check in
          files and /tmp must be large enough to hold all these files.
 
 
          6.13  HOW TO RECOVER WHEN THE ERROR 0010-783 IS DISPLAYED
 
          QUESTION:
 
          I got the following error message when I tried to check in the
          file "acode/file1" in release "alpha1":
 
            0010-783 A version control error may have caused a file to become
                     corrupt.  Should the version control file
                     /u/tutfam1/vc/0/0/0/0/s.01 need to be restored, a recovery
                     file has been saved on the CMVC server with the file name
                     /tmp/error.cmvcEkSFoAwAAA/01.recovery .
                     Please save this message and notify your family administrator.
            0010-045 An error occurred when the CMVC Server/6000 tried to
                     check in file acode/file1 to the
                     version control file repository.
 
          How do I recover the file?
 
          ANSWER:
 
          Generally, we recommend that you follow the procedures already
          listed in this chapter for adjusting SCCS in order to get the
          database and SCCS synchronized.  However, for completeness we are
          providing an example where the database is updated to restore
          synchronization.
 
          WARNING:  :  We do not encourage updating the database directory.
          You have to understand that some family administrators have a
          great deal of database administration skills and can follow these
          procedures without difficulty.  Even if you are a database
          skilled administrator, we remind you that if you alter the data-
          base, it is at your own risk!  Problems with CMVC resulting from
          such changes do not constitute "defects in the product".  IBM has
          a services organization that can provide fee-based services to
          help you in such cases.  Pay attention to the following informa-
          tion provided in the error message:
 
 
          50  CMVC FAQ: version control
 
 
          o   /u/tutfam1/vc/0/0/0/0/s.01
 
              This means the sourceId=000001
 
          o   /tmp/error.cmvcEkSFoAwAAA/01.recovery
 
              This means the original /u/tutfam1/vc/0/0/0/0/s.01 is saved
              in the above file.
 
          o   acode/file1
 
              This is the file name from the user's point of view.
 
          The following sequence should correct most synchronization prob-
          lems where the CMVC database tables indicate that a file is
          checked out (a filesOut database table record exists for the
          "fileId" and the "versionId" of the file) but the version control
          system does not reflect that in the file's status.
 
          1.  Invoke the database command:
 
              DATABASE  STARTING SQL INTERFACE
              FOR DB2   "db2 connect to familyName"
              ORACLE    "sqlplus familyName/$ORACLE_PASS"
              INFORMIX  "isql familyName -q"
 
                        then choose option 'New'
 
          2.  Do the following (using Oracle syntax):
 
                SELECT id FROM path WHERE name='acode/file1';
                nuPathId=22
 
                SELECT id FROM releases WHERE name='alpha1';
                releaseId=19
 
                SELECT id FROM files WHERE nuPathId=22 and releaseId=19;
                fileId=24
 
                SELECT * FROM filesOut WHERE fileId=24;
                1 row retrieved
 
                DELETE   FROM filesOut WHERE fileId=24;
                1 row deleted
 
                The file is no longer checked out.
 
          3.  Or do the following:
 
 
                                     Error recovery: specific scenarios  51
 
 
                SELECT id FROM files WHERE sourceId=000001;
                fileId=24
 
                SELECT * FROM filesOut WHERE fileId=24;
                1 row retrieved
 
                DELETE   FROM filesOut WHERE fileId=24;
                1 row deleted
 
              The file is no longer checked out.
 
          4.  Exit from sqlplus or isql.
 
          5.  If you use SCCS, then do the following:
 
              o   Copy /tmp/error.cmvcEkSFoAwAAA/01.recovery into
                  $HOME/vc/0/0/0/0/s.01
 
          6.  If you use PVCS, then do the following:
 
              o   su - root
              o   Copy /tmp/error.cmvcEkSFoAwAAA/01.recovery into
                  $HOME/vc/0/0/0/0/s.01
              o   chown pvcs $HOME/vc/0/0/0/0/s.01
              o   CTRL-D
 
          The file should now be repaired.
 
 
          6.14  VC FILES OUT OF SYNC WITH DB WHEN DATABASE WAS RESTORED
          FROM OLD COPY
 
          QUESTION:
 
          A customer restored the CMVC database from an older copy than
          current SCCS files, and so, any files which are out of sync have
          a later version of SCCS SID than the SID indicated in the data-
          base.
 
          All files which are out of sync are text files (NOT binary
          files).
 
          ANSWER:
 
          1.  Determine all the sourceId's of the files which you suspect
              are out of sync.  The following will illustrate by example
              how to determine the sourceId:
 
                SCCS file pathName:    $HOME/vc/0/1/2/3/s.54
                CMVC sourceId:         012354
 
          2.  Do the following queries in Oracle sqlplus:
 
 
          52  CMVC FAQ: version control
 
 
                    $ORACLE_HOME/bin/sqlplus familyName/$ORACLE_PASS
                    SQL>  spool /tmp/CMVCfile.info
                    SQL>  select id, type, nuVersionSID, nuPathName, releaseName
                    SQL>  from FileView
                    SQL>  where sourceId in (??, ??, ??);          (from #1 above)
                    SQL>  spool off
 
                    SQL>  spool /tmp/CMVCfileout.info
                    SQL>  select fileId, fileNuPath, newSID from FilesOutView where
                    SQL>  fileId in (select id from Files where sourceId in (??, ??, ??);
                    SQL>  spool off
 
          3.  Questions:
 
              o   Are there binary files (check the "type" field)?  If the
                  type field is "binary" or "long", then this is equivalent
                  to being a binary file.
 
              o   Are any of the files associated with more than one
                  release?
 
              o   Are any of the releases "affected" in tracking mode?
 
          4.  Sanity checks:
 
              o   Perform Release -extract of all "unaffected" releases.
                  If this works, you are OK.
 
                  If SCCS errors occur, than there may be other files which
                  are out of sync than what you suspected.
 
              o   Perform Level -extract of all "unaffected" releases.  If
                  this works, you are OK.
 
                  If SCCS errors occur, then there may be other files which
                  are out of sync.
 
          5.  Draw a chart of all suspected files which are out of sync
              with the following headings:
 
                    Database           Database  Database       SCCS                 SCCS
                    Status             newSID    nuVersionSID   Status               SID
                    -----------------  --------  ------------   ------------------   ----
                    locked/not locked    1.3       1.2          p.file / no p.file   1.3
 
              Database Status of "locked" means that there is an entry for
              the file in the FilesOutView view.
 
              SCCS status of p.file implies that the file is locked in
              SCCS.
 
              The different scenarios are as follows:
 
 
                                     Error recovery: specific scenarios  53
 
 
                    Database           Database  Database       SCCS                 SCCS
                    Status             newSID    nuVersionSID   Status               SID
                    -----------------  --------  ------------   ------------------   ----
                 A) locked               1.3       1.2          p.file               1.4
                 B) not locked           n/a       1.2          p.file               1.4
                 C) locked               1.3       1.2          no p.file            1.4
                 D) not locked           n/a       1.2          no p.file            1.4
 
 
          6.  Perform the following steps to manually synchronize the VC
              files and the Oracle Database info and restore the latest
              SCCS file.
 
              Note you may lose some of the history of the SCCS changes if
              there is more than one delta between the Database SID and the
              SCCS SID.
 
              a.  Check each s.file with SCCS prs command to determine
                  current SCCS SID:
 
                    prs $HOME/vc/0/1/2/3/s.54
 
              b.  Extract the current version of the SCCS and move it to
                  another location in your workstation:
 
                    (NOTE:  1.4 is the last SCCS SID from prs output)
 
                    get $HOME/vc/0/1/2/3/s.54 -r 1.4
                    mv 54 /tmp/restore/54
 
              c.  Remove the SCCS p.file since the wrong SID is being
                  reserved.  This is done for scenarios A and B only.
 
                    (NOTE:  1.5 is the reserved SID in the p.54 file)
 
                    unget -n -s 1.5  $HOME/vc/0/1/2/3/s.54
 
              d.  Undo SCCS deltas until the SCCS SID matches the Database
                  SID by repeatedly issuing rmdel commands:
 
                    rmdel -r 1.4  $HOME/vc/0/1/2/3/s.54
                    rmdel -r 1.3  $HOME/vc/0/1/2/3/s.54
                    ... and so on ...
 
              e.  At this point, the SCCS SIDs should be in sync with the
                  Database SID.  Check each s.file with SCCS prs command to
                  ensure that the SCCS SID matches the Database SID:
 
                    prs $HOME/vc/0/1/2/3/s.54
 
              f.  Create an SCCS p.file for the correct reserved SID.  This
                  is done for scenarios A and C only.
 
                    get -e $HOME/vc/0/1/2/3/s.54 -r 1.2
 
 
          54  CMVC FAQ: version control
 
 
              g.  Perform CMVC File -lock commands on files.  Do this only
                  for scenarios B and D and must be performed from a CMVC
                  client:
 
                    File -lock pathName -release releaseName
 
              h.  Perform CMVC File -checkin commands to checkin the
                  version which you extracted in 6b on page 54 (such as,
                  /tmp/restore/54).  It should be renamed to the correct
                  CMVC pathName.  If the release has a tracking mode, then
                  you will need to specify a track to check in the file.
 
                    mv /tmp/restore/54 /tmp/restore/CMVCpathName
                    File -checkin pathName -release releaseName \
                         -relative /tmp/restore [-defect XXXX]
 
 
                                     Error recovery: specific scenarios  55
 
 
          56  CMVC FAQ: version control
 
 
                                                  APPENDIX A.  BIBLIOGRAPHY
 
 
          For more information on how to use CMVC, you can consult the fol-
          lowing manuals and publications:
 
            SC09-1596-01  IBM CMVC Client Installation and Configuration
            SC09-1597-01  IBM CMVC User's Reference
            SC09-1631-02  IBM CMVC Server Administration and Installation
            SC09-1633-00  IBM CMVC Concepts
            SC09-1635-01  IBM CMVC Commands Reference
 
          The following Redbooks offer practical advice on CMVC:
 
            GG24-4178-00  Did you say CMVC?
            GG24-4345     CMVC: Customer's Perspective
 
          The following technical reports describe in detail useful hints
          on using CMVC:
 
            29.2130  Diagnosing and solving Release -extract problems with CMVC
            29.2169  How to use CMVC with National Language Support (NLS)
                     and Double-Byte Character Sets (DBCS)
            29.2180  How to do routine tasks in the OEM Platforms for CMVC
            29.2183  Using CMVC for Products with Multiple
                     National Language Versions (NLVs)
            29.2232  How to do migration tasks with CMVC
            29.2244  How to build and package the CMVC client for Windows 3.1
            29.2245  How to build and package the CMVC client for OS/2
            29.2253  Comparison between CMVC 2.3 and TeamConnection 2
            29.2254  Migrating from CMVC 2.3 to TeamConnection 2
            29.2268  CMVC frequently asked questions:
                     license management with NetLS/iFOR
            29.2269  How to build and package the CMVC Server/Client for UNIX
 
 
          A.1  HOW TO GET ELECTRONIC COPIES OF MANUALS AND TECHICAL REPORTS
 
          Many of the manuals and technical reports mentioned in this docu-
          ment can be downloaded as follows:
 
          o   From the IBM intranet (only for IBM employees).
 
          o   From the Internet (open to everyone).
 
 
          A.1.1  IBM Intranet
          ___________________
 
 
                                              Appendix A.  Bibliography  57
 
 
          A.1.1.1  Web Home Page
 
          You can access the CMVC Service/Development Home Page at:
 
            http://keithp.raleigh.ibm.com/&tilde.cmvcsupt
 
          From the index at the top of the page, select:
 
          o   Technical Reports and related tools
 
          o   Copies of ALL the archived versions for the forums CMVC and
              CMVC6000
 
          o   Documentation in PostScript files
 
          o   Documentation in ASCII text files
 
 
          A.1.1.2  FTP
 
          You can download the code from our internal FTP site, by doing:
 
          1.  ftp keithp.raleigh.ibm.com
 
          2.  login as 'anonymous' and for password give your email
              address.
 
          3.  cd pub/cmvc/doc
 
          4.  binary
 
          5.  get fileName
 
          6.  quit
 
 
          A.1.2  Internet
          _______________
 
 
          A.1.2.1  Web Home Page
 
          Not available.
 
 
          58  CMVC FAQ: version control
 
 
          A.1.2.2  FTP
 
          You can download the code from our external FTP site, by doing:
 
          1.  ftp ftp.software.ibm.com
 
          2.  login as 'anonymous' and for password give your email
              address.
 
          3.  cd ps/products/cmvc/doc
 
          4.  binary
 
          5.  get fileName
 
          6.  quit
 
 
                                              Appendix A.  Bibliography  59
 
 
          60  CMVC FAQ: version control
 
 
                      APPENDIX B.  COPYRIGHTS, TRADEMARKS AND SERVICE MARKS
 
 
          The following terms used in this technical report, are trademarks
          or service marks of the indicated companies:
 
            +---------------------+-------------------------------------------+
            | TRADEMARK,          | COMPANY                                   |
            | REGISTERED          |                                           |
            | TRADEMARK OR        |                                           |
            | SERVICE MARK        |                                           |
            +---------------------+-------------------------------------------+
            | IBM                 | IBM Corporation                           |
            | AIX                 |                                           |
            | OS/2                |                                           |
            | PC-DOS              |                                           |
            | CMVC                |                                           |
            | DB2/6000, DB2       |                                           |
            | TeamConnection      |                                           |
            +---------------------+-------------------------------------------+
            | PostScript          | Adobe Systems Incorporated                |
            +---------------------+-------------------------------------------+
            | Informix            | Informix Inc.                             |
            +---------------------+-------------------------------------------+
            | PVCS                | InterSolv, Inc.                           |
            +---------------------+-------------------------------------------+
            | Microsoft           | Microsoft Corporation                     |
            | Windows             |                                           |
            | MS-DOS              |                                           |
            +---------------------+-------------------------------------------+
            | Oracle              | Oracle Corp.                              |
            +---------------------+-------------------------------------------+
            | NFS                 | Sun Microsystems Inc.                     |
            +---------------------+-------------------------------------------+
            | UNIX                | X/Open Co., Ltd.                          |
            +---------------------+-------------------------------------------+
 
          END OF DOCUMENT
 
 
                  Appendix B.  Copyrights, Trademarks and Service marks  61