Deleting a directory Structure

The following section for reasons of completeness describes how a directory structure may be modified.

Deleting a directory via FORTRAN

To remove a directory via a FORTRAN program we make a call to the routine CDDDIR. An outline of a program that would delete our DC directory is shown below.

                  FORTRAN deletion of a directory
                                  

      PROGRAM DELDIR
*     ==============
*
*     To delete a directory in a database structure
*     First do usual open database code.
*
      PARAMETER    (NWPAW=100000)
      COMMON/PAWC/ PAW(NWPAW)
      PARAMETER    (MAXOBJ=1000)
      CHARACTER*4  CHTOP
      CHARACTER*80 CHFILE
      CHARACTER*40 DNAME
      CALL CDPAW(NWPAW,NHBOOK,IDIV,'USR-DIV',5000,50000,'ZPHU',IRC)
      LUNCD  = 1
      LUNFZ  = 2
      CALL CDPREF(10,'GE',CHTOP,CHFILE,IRC)
      IF(IRC.GT.4) THEN
         PRINT *,'EGOPEN. STOPPING DUE TO FATAL ERROR FROM CDPREF'
         STOP 16
      ENDIF
      LRECL  = 0
      CALL CDOPEN(LUNCD,LUNFZ,CHTOP,CHFILE,LRECL,IDIV,' ',IRC)
*
*     Construct directory name to be removed
*
      DNAME='//CDGE/GEOMETRY/DC'
*
*     Delete the directory
*
      CALL CDDDIR (DNAME,' ',IRC)
*
*     Terminate
*
      CALL CDEND(' ','A',IRC)
      END

If we were now to issue another interactive TREE command we would notice that the directory is no longer part of our database structure.

Multiple directory deletion

As well as allowing individual directories to be deleted HEPDB also allows the deletion of multiple directories via the CDKEEP routine. As the name suggests, all subdirectories that are not specified are deleted. The call to CDKEEP is envisaged as follows:

              Multiple directory deletion via CDKEEP
                                  

      PROGRAM MDELDIR
*     ================
*
*     To delete many directories in a database structure
*     First do usual open database code.
*
      PARAMETER    (NWPAW=100000)
      COMMON/PAWC/ PAW(NWPAW)
      PARAMETER    (MAXOBJ=1000)
      CHARACTER*4  CHTOP
      CHARACTER*80 CHFILE
      CHARACTER*40 DNAME(10)
      CALL CDPAW(NWPAW,NHBOOK,IDIV,'USR-DIV',5000,50000,'ZPHU',IRC)
      LUNCD  = 1
      LUNFZ  = 2
      CALL CDPREF(10,'GE',CHTOP,CHFILE,IRC)
      IF(IRC.GT.4) THEN
         PRINT *,'EGOPEN. STOPPING DUE TO FATAL ERROR FROM CDPREF'
         STOP 16
      ENDIF
      LRECL  = 0
      CALL CDOPEN(LUNCD,LUNFZ,CHTOP,CHFILE,LRECL,IDIV,' ',IRC)
*
*     Construct List of directory paths to be kept
*
      DNAME(1)='//CDGE/GEOMETRY/PC'
      DNAME(2)='//CDGE/GEOMETRY/DC'
*
*     Delete the directory
*
      CALL CDKEEP (DNAME,2,' ',IRC)
*
*     Terminate
*
      CALL CDEND(' ','A',IRC)
      END

Other directory related operations

As well as the commands given above for the creation and deletion of directories there are also commands to allow manipulation of directory partitions. (See elsewhere in this manual for description of directory partitioning.) However such commands are outside the scope of this tutorial and shall therefore only be mentioned in passing below.

Subroutines exist to allow the conversion of a non-partitioned directory to a partitioned one (routine CDPART) and to allow the deletion of specific directory partitions (routine CDPURP).