Sun Studio 12: Fortran Programming Guide

3.2.1 Controlling Files With SCCS

Putting files under SCCS control involves:

3.2.1.1 Creating the SCCS Directory

To begin, you must create the SCCS subdirectory in the directory in which your program is being developed. Use this command:


demo% mkdir SCCS

SCCS must be in uppercase.

3.2.1.2 Inserting SCCS ID Keywords

Some developers put one or more SCCS ID keywords into each file, but that is optional. These keywords are later identified with a version number each time the files are checked in with an SCCS get or delget command. There are three likely places to put these strings:

The advantage of using keywords is that the version information appears in the source listing and compiled object program. If preceded by the string @(#), the keywords in the object file can be printed using the what command.

Included header files that contain only parameter and data definition statements do not generate any initialized data, so the keywords for those files usually are put in comments or in parameter statements. In some files, like ASCII data files or makefiles, the SCCS information will appear in comments.

SCCS keywords appear in the form %keyword% and are expanded into their values by the SCCS get command. The most commonly used keywords are:

%Z% expands to the identifier string @(#) recognized by the what command.%M% expands to the name of the source file.%I% expands to the version number of this SCCS maintained file.%E% expands to the current date.

For example, you could identify the makefile with a make comment containing these keywords:


#      %Z%%M%       %I%       %E%

The source files, startupcore.f, computepts.f, and pattern.f, can be identified by initialized data of the form:


      CHARACTER*50 SCCSID
      DATA SCCSID/"%Z%%M%       %I%       %E%\n"/

When this file is processed by SCCS, compiled, and the object file processed by the SCCS what command, the following is displayed:


demo% f95 -c pattern.f
...
demo% what pattern
pattern:
      pattern.f 1.2 96/06/10

You can also create a PARAMETER named CTIME that is automatically updated whenever the file is accessed with get.


      CHARACTER*(*) CTIME
      PARAMETER ( CTIME="%E%")

INCLUDE files can be annotated with a Fortran comment containing the SCCS stamp:


C       %Z%%M%       %I%       %E%

Note –

Use of single letter derived type component names in Fortran 95 source code files can conflict with SCCS keyword recognition. For example, the Fortran 95 structure component reference X%Y%Z when passed through SCCS will become XZ after an SCCS get. Care should be taken not to define structure components with single letters when using SCCS on Fortran 95 programs. For example, had the structure reference in the Fortran 95 program been to X%YY%Z, the %YY% would not have been interpreted by SCCS as a keyword reference. Alternatively, the SCCS get -k option will retrieve the file without expanding SCCS keyword IDs.


3.2.1.3 Creating SCCS Files

Now you can put these files under control of SCCS with the SCCS create command:


demo% sccs create makefile commonblock startupcore.f \
  computepts.f pattern.f
demo%