next up previous contents index
Next: Routines to modify Up: The FATMEN Fortran Previous: Novice interface routines

Routines that manipulate the FATMEN catalogue

Initialise FATMEN system

CALL FMINIT (IXSTOR*,LUNRZ,LUNFZ,DBNAME,IRC*)

IXSTOR
Integer variable to return the number of the store initialised for FATMEN.
LUNRZ
Integer variable specifying the FORTRAN logical unit for the FATMEN RZ file.
LUNFZ
Integer variable specifying the FORTRAN logical unit to be used to send updates to the FATMEN server.
DBNAME
Character variable to specify the database and group name in the form //database/group, e.g. //CERN/DELPHI.
IRC
Integer variable in which the return code is returned.

This routine initialises the FATMEN system. LUNRZ and LUNFZ are the logical units that will be used to access the database for reading and writing. If read-only access is required, LUNFZ should be set to 0. The database name DBNAME is a character string indicating the name of the database that is to be accessed. This field must be of the form '//CERN/experiment'.

On VM systems, the virtual card punch is used to communicate updates with the service machine that handles the database. As the punch may be in use for other purposes, both positive and negative values of LUNFZ are foreseen. If LUNFZ > 0, the punch will be used directly, which implies that it cannot be used by the calling programme for any other purpose. If LUNFZ < 0, a temporary file will be created and sent via SENDFILE to the server. The disk with most free space that is accessed in WRITE mode will be used for this purpose. If LUNFZ > 0, FATMEN will assume that it can write directly to the PUN device.

Example of using the FMINIT routine

*     Initialise FATMEN for group CPLEAR
      CALL FMINIT(IXSTOR,1,2,'//CERN/CPLEAR',IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMINIT'

Terminate FATMEN package

CALL FMEND (IRC*)

IRC*
Integer variable in which the return code is returned.

This routine should be called when no further access to the FATMEN file catalogue is required, normally at program termination. This routine automatically calls the routine FMUPDT to ensure that any outstanding updates are sent to the server.

Example of using the routine FMEND

      CALL FMEND(IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMEND'

After a call to FMEND, a further call to FMINIT may be made, to look at the same or different FATMEN catalogue.

Set logging level of FATMEN package

CALL FMLOGL (LEVEL)

LEVEL
Integer variable to set the level of logging required.
-3
Suppress all log messages
-2
Error messages
-1
Terse logging
0
Normal (FMINIT, FMEND etc.)
1
Log calls to FATMEN routines (FORTRAN callable interface)
2
Log to monitor FATMEN internal decisions, such as selection of a dataset.
3
Debug messages

This routine establishes the LEVEL of diagnostic printing from the FATMEN package.

Example of using the routine FMLOGL

*     Set maximum logging level to monitor FATMEN progress
      CALL FMLOGL(3)

Control updating mode

CALL FMUPDT (MAX,NGROUP,IFLAG,IRC*)

MAX
Integer variable specifying the maximum number of updates that may be performed. If this number is exceeded, the program will be terminated by a call to the Zebra routine ZFATAM.
NGROUP
Integer variable specifying the number of updates that are to be grouped together.
IFLAG
Integer variable which allows outstanding updates to be sent or purged, or to reset the system defaults.
IRC
Integer variable specifying the return code.

This routine controls the updating mode of the FATMEN package. MAX is the maximum number of updates that may be issued by a single job. NGROUP is the number of updates to send together. If IFLAG=-1, the system defaults of MAX=999, NGROUP=0 (send each update separately) will be applied. If IFLAG=0, MAX and NGROUP will be reset as specified, with any outstanding updates sent immediately. If IFLAG=1, MAX and NGROUP will be reset as specified, with any outstanding updates purged.

Example of using the FMUPDT routine

*     Reset updating mode to the system defaults
      CALL FMUPDT(MAX,NGROUP,-1,IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMUPDT
*     Cancel any outstanding updates and limit future updates to 10
      CALL FMUPDT(10,NGROUP,1,IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMUPDT

Purge old entries from catalogue

CALL FMPURG (PATH,KEYSEL,MAXSIZ,MINACC,MAXDAYS,MINCPS,LUNPUR,CHOPT,IRC*)

PATH
Character variable specifying the path name to be purged.
KEYSEL
Integer array of length 10 specifying the KEY selection to be applied.
MAXSIZ
Integer variable specifying the file size threshold, in Megabytes. Files with size <= MAXSIZ escape deletion.
MINACC
Integer variable specifying the number of accesses. Files with accessed => MINACC escape deletion.
MAXDAYS
Integer variable specifying the number of number of days permitted since last access. Files with accessed <= MAXDAYS ago escape deletion.
MINCPS
Integer variable specifying the minimum number of copies required for a file to be candidate for deletion. Files with <= MINCPS escape deletion.
LUNPUR
Integer variable specifying the FORTRAN logical unit to be used
CHOPT
Character variable specifying the required options.
P
print usage statistics on these files
K
write a FATMEN KUMAC on LUNPUR to remove these entries
R
remove these entries
IRC
Integer variable in which the return code is returned.

This routine searches for files matching the specified path and KEYSEL selection for entries eligible for deletion. A check may be bypassed by coding a -1 for the corresponding parameter. Thus, to purge files without checking on the number of accesses, specify a -1 for MINACC.

Example of using the routine FMPURG

      DIMENSION KEYSEL(10)
*     Restrict search to 3480s
      KEYSEL(MKMTFA) = 2
*     Restrict search to location code 1
      KEYSEL(MKLCFA) = 1
*     Make no check on Copy Level
      KEYSEL(MKLCFA) = -1
*
*     Print all files eligible for purge that are 80 MB or larger,
*     have been accessed less than 10 times, have not been accessed
*     in the last 60 days, and for which at least 3 copies exist.
*
      CALL FMPURG('//CERN/CNDIV/J*',KEYSEL,80,10,60,3,0,'P',IC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMPURG'

Get information on named file

CALL FMGET (GENAM,LBANK*,KEYS*,IRC*)

GENAM
Character variable of maximum length 255 to specify the generic name.
LBANK
Integer variable to return the address of the bank corresponding to the generic name GENAM.
KEYS
Integer array of length 10 to return the keys vector associated with the specified generic name.
IRC
Integer variable in which the return code is returned.

This routine returns the address of the bank LBANK and the keys vector KEYS for the specified generic name GENAM. Should multiple entries exist for the given generic name GENAM, the FATMEN system will choose the most appropriate, according to a simple algorithm. Should a specific copy be required, the routine FMGETK should be used. Warning: any bank at the address LBANK will be dropped by this routine on input. See the example on page gif for an example of using a link area to save the address of multiple banks, e.g. when calling this routine in a loop.   The procedure for selecting a given copy of a dataset is as follows:

      Where access to remote data is available, the procedure will then continue, searching for datasets on remote disks, in remote robots and finally on remote manually mounted tapes.

Example of using the FMGET routine

*     Select a copy of a dataset using default FATMEN selection.
      CALL FMGET('//CERN/CNDIV/CHRIS/TAPE8',LBANK,KEYS,IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMGET'

Get information on named file with key selection

CALL FMGETK (GENAM,LBANK*,*KEYS*,IRC*)

GENAM
Character variable of maximum length 255 to specify the generic name.
LBANK
Integer variable to return the address of the bank corresponding to the generic name GENAM.
KEYS
Integer array of length 10 to return the keys vector associated with the specified generic name. The keys vector is also used to select a particular copy of a dataset.
IRC
Integer variable in which the return code is returned.

This routine returns the address of the bank LBANK for the combination of the generic name GENAM and key vector KEYS specified. This allows the user to select a particular copy of a file. Warning: any bank at the address LBANK will be dropped by this routine on input. See the example on page gif for an example of using a link area to save the address of multiple banks, e.g. when calling this routine in a loop.  

Example of using the FMGETK routine

      Select a given copy of a dataset.
*     The vector MYKEYS was obtained from FMSELK.
      CALL FMGETK('//CERN/CNDIV/CHRIS/TAPE8',LBANK,MYKEYS(1,1),IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMGETK'

Add entry to FATMEN catalogue

CALL FMPUT (GENAM,LBANK,IRC*)

GENAM
Character variable of maximum length 255 to specify the generic name.
LBANK
Integer variable to input the address of the bank corresponding to the generic name specified.
IRC
Integer variable in which the return code is returned.

This routine enters the information in the bank with address LBANK for the specified generic name GENAM in the database. If a matching dataset already exists for this generic name, nothing will be added to the database. In all other cases a new entry will be made. Before the entry is sent to the FATMEN server, the routine FMVERI is automatically called. Should FMVERI return a non-zero return code, the entry will not be sent to the server. This is to ensure that the FATMEN catalogue is correctly updated and that the data can be successfully retrieved. See the description of the FMCOMP routine on page gif for details of the association of generic names and datasets.

Example of using the FMPUT routine

 
      CALL FMPUT('//CERN/CHARM2/TEST/DST1/ELEC/HO20/NOM/E02/FILE1',
     +LBANK,IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMPUT'

Modify existing entry

CALL FMMOD (GENAM,LBANK,IFLAG,IRC*)

GENAM
Character variable of maximum length 255 to specify the generic name.
LBANK
Integer variable to input the address of the bank corresponding to the generic name specified.
IFLAG
Integer variable to control the mode of operation.
0
the entry for the generic name GENAM will be added if it does not exist, or replaced if it does.
1
the entry will be replaced if it exists but otherwise not added.
IRC
Integer variable in which the return code is returned.

This routine is similar top the routine FMPUT, except that it also allows an existing entry to be modified. Before the entry is sent to the FATMEN server, the routine FMVERI is automatically called. Should FMVERI return a non-zero return code, the entry will not be sent to the server. This is to ensure that the FATMEN catalogue is correctly updated and that the data can be successfully retrieved. See the description of the FMCOMP routine on page gif for details of the association of generic names and datasets.

Example of using the FMMOD routine

*
*     Update an existing entry with the number of Megabytes written
      IQ(LBANK+MFSZFA) = 200
      CALL FMMOD('//CERN/CNDIV/CHRIS/TAPE8',LBANK,1,IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMMOD

Create a new FATMEN bank

CALL FMBOOK (GENAM,KEYS*,LADDR*,*LSUP*,JBIAS,IRC*)

GENAM
Character variable of maximum length 255 to specify the generic name.
KEYS
Integer array of length 10 to return the keys vector associated with the specified generic name.
LADDR
Integer variable to return the address of the bank created.
LSUP
if JBIAS < 0: address of the supporting up bank
if JBIAS = 0: address of the supporting previous bank
if JBIAS > 0: link bias in the supporting bank
JBIAS
if JBIAS < 1: link bias in the supporting bank
if JBIAS = 1: create top-level bank
if JBIAS = 2: create stand-alone bank
IRC
Integer variable in which the return code is returned.

This routine will create a new ZEBRA bank for the specified generic name GENAM and fill in default values. The user may then modify these before committing the changes via FMPUT. If IRC is non-zero, the IQUEST vector will contain the error condition signaled by MZBOOK. See the description of MZBOOK in the ZEBRA manual.

The address of the bank lifted is the users responsibility and should be saved in a link area.

Example of using the FMBOOK routine

*
      CALL FMBOOK(GNAME,KEYS,LUSRBK,LSUP,JBIAS,IRC)

FMBOOK returns warning conditions using the IQUEST vector. The following conditions may be reported:

IQUEST(11)
0 if this generic name does not exist, 1 otherwise.
IQUEST(12)
0 if the corresponding directories already exist, 1 otherwise.

Create a link to an existing catalogue entry

CALL FMLN (CHSRCE,CHTRGT,CHCOMM,IVECT,CHOPT,IRC*)

CHSRCE
Character variable of maximum length 255 to specify the generic name of the link to an existing object.
CHTRGT
Character variable of maximum length 255 specifying an existing generic name.
CHCOMM
Character variable of maximum length 80 specifying the comment to be associated to the link.
IVECT
Vector of 10 user words to be associated to the link.
CHOPT
Character variable specifying the required options.
C
set the comment field to the string specified in CHCOMM
U
set the user words to the values in the vector IVECT
IRC
Integer variable in which the return code is returned.
Use the FMLN routine to make a link to an existing catalogue entry.

In Unix parlence, the sourcefile is the real file and the targetfile the link that points to it. To avoid even further confusion, the same terminology is adopted here.

If the existing entry is itself a link, the link will point to the source of that link.

A link is identified by having location code 0. The source file name is stored in the FATMEN bank at the offset MFQNFA.

Links can be useful in the following scenario. DELPHI write single file 3480 cassettes which contain more than one run. There is a generic name for each run that points to the same file. Additionally, there is also a so-called SUMT entry (for summary tape). This can cause house keeping problems, particularly when making copies for data export.

A solution to the above problem is to make the run specific generic names links. Only the SUMT entries are copied, moved or deleted. When a file is accessed via a link, the link is automatically resolved. The FATMEN selection then procedes as if the sourcefile name had been given.

A limitation of the current implementation is that it does not cater for the situation when a single run is copied to hotter media, e.g. disk. This would involve some reworking of the selection logic and remains pending demand from actual usage.

Remove entry from FATMEN catalogue

CALL FMRM (GENAM,LBANK*,KEYS,IRC*)

GENAM
Character variable of maximum length 255 to specify the generic name.
LBANK
Integer variable to input the address of the bank corresponding to the generic name specified.
KEYS
Integer array of length 10 to pass the keys vector associated with the specified generic name.
IRC
Integer variable in which the return code is returned.

This routine marks the entry generic name GENAM for deletion. An entry is uniquely identified by the following information: Host name, DSN (for disk files), Location, VID, VSN, File sequence number (for tape files), contained in the bank at address LBANK. Files may only be deleted by the creator. If a non-zero key vector KEYS is input, KEYS(1) will be used to select a specific copy of a file for deletion. If only one match for the specified name exists, KEYS(1) may be zero. If more than one entry for the specified generic name exists, KEYS(1) must specify the copy that is to be deleted.

Example of using the FMRM routine

      DIMENSION KEYS(10)
      CALL VZERO(KEYS,10)
      LBANK = 0
      CALL FMRM('//CERN/CHARM2/TEST/DST1/ELEC/HO20/NOM/E02/FILE1',
     +LBANK,KEYS,IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMRM'

Remove a link from a FATMEN catalogue

CALL FMRMLN (CHLINK,LUN,CHFILE,CHOPT,IRC*)

CHLINK
Character variable specifying the path to be searched for dangling links, containing wild-cards as necessary
LUN
Unit number on which the file CHFILE is written, with option F
CHFILE
Character variable specifying the name of the file to be written, with option F.
CHOPT
Character variable specifying the required options.
P
Print the names of dangling links
D
Write the names of dangling links in the form rm generic-name ksn
R
Remote dangling links
F
Redirect output to the file CHFILE on the unit LUN
IRC
Integer variable in which the return code is returned.

Make directory

CALL FMKDIR (CHDIR,IRC*)

CHDIR
Character variable of maximum length 255 to specify the name of the directory to be created.
IRC
Integer variable in which the return code is returned.

This routine creates the specified directory CHDIR.

Example of using the routine FMKDIR

      CALL FMKDIR('//CERN/ALEPH/MC/TEST',IRC)
      IF(IRC.NE.0) PRINT *,'Return code ',IRC,' from FMKDIR

FMKDIR returns warning conditions using the IQUEST vector. The following conditions may be reported:

IQUEST(12)
0 if the specified directory already exists, 1 otherwise.



next up previous contents index
Next: Routines to modify Up: The FATMEN Fortran Previous: Novice interface routines


Janne Saarela
Mon May 15 09:59:59 METDST 1995