Tailoring the FATMEN shell

The FATMEN shell may be tailored by

  1. The use of KUIP macros
  2. Modifying the FATMEN CDF file, e.g. adding extra commands

KUIP macros

KUIP macros consist of files containing FATMEN or KUIP system commands. A trivial example might contain commands such as

                    Example macro CDOPAL KUMAC
                                  

MESS 'Initialise FATMEN for OPAL'
INIT OPAL
MESS 'Change directory to PROD/PASS3/FILT/P1R1039L044'
CD PROD/PASS3/FILT/P1R1039L044
MESS 'Count the number of files in this directory'
FC

The output of the above macro is given below:

                 Result of executing CDOPAL KUMAC
                                  

FAT3@cernvm;
fm
Type INIT to initialise FATMEN>
exec cdopal
FMINIT.  Initialisation of FATMEN package
FATMEN   1.05  900312 13.00  CERN PROGRAM LIBRARY FATMEN=Q123
         This version created on      900312  at        1600
Linked to FMOPAL               mode Z
FAOPEN : for FARZ on Unit    1 opened File CERN FATRZ
Current Working Directory = //CERN/OPAL
Current Working Directory = //CERN/OPAL/PROD/PASS3/FILT/P1R1039L044
Files:    5
FM>

Further details can be found in the KUIP Long writeup.

Adding commands to the FATMEN shell

Extra commands maybe added to the FATMEN shell by

  1. Creating a Command Definition File (CDF)
  2. Merging this with the FATMEN CDF file (Patch FMCDF on the FATMEN PAM)
  3. Processing the resultant CDF file using the command KUIPC
  4. Compiling the FORTRAN file produced by the KUIPC command
  5. Linking with the FATMEN library

For example, we could add the command XLS which would

  1. Accept a generic name which could contain wild cards at any point
  2. Find all matching files
  3. Display the file entries

(In fact, the ls command has been modified to do just this!)

                     CDF file for XLS command
                                  

>COMMAND XLS
>GUIDENCE
Use the XLS command to perform an extended LS command.
Syntax: XLS path options
Options:
  A - list all attributes, except DZSHOW (option Z).
  C - display comment field associated with file
  F - list file attributes, such as start/end record and block
  G - list the full generic name of each file
  K - list keys associated with this file (copy level, media type, location)
  L - list logical attributes, such as FATMEN file format
      (ZEBRA exchange etc.)
  M - list media attributes, such as VSN, VID, file sequence number for tape
      files, host type and operating system for disk files.
  N - lists dataset name on disk/tape of this file
  O - list owner, node and job of creator etc.
  P - list physical attributes, such as record format etc.
  S - lists security details of this file (protection)
  T - list date and time of creation, last access etc.
  U - list user words.
  Z - dump ZEBRA bank with DZSHOW.
>ACTION FMXLSC
>PARAMETERS
+
FILE 'File or pathname' C D='CURRENT_DIRECTORY'
OPTN 'Options'          C D=' '

Our action routine, FMXLSC, might look like the following:

                  Example action routine, FMXLSC
                                  

      SUBROUTINE FMXLSC
      PARAMETER     (MAXFIL=10000)
      PARAMETER     (LKEYFA=10)
      DIMENSION     KEYS(LKEYFA,MAXFIL)
      CHARACTER*255 FILES(MAXFIL)
      CHARACTER*255 PATH
      CHARACTER*25  CHOPT
*
      CALL KUGETC(PATH,LPATH)
      CALL KUGETC(CHOPT,LCHOPT)
*
      CALL FMLIST(PATH(1:LPATH),FILES,KEYS,NFOUND,MAXFIL,IRC)
*
      DO 10 I=1,NFOUND
10    CALL FMSHOW(FILES(I),LBANK,CHOPT(1:LCHOPT),IRC)
*
      END