next up previous index
Next: M501 Locating a Up: CERNLIB Previous: M441 Handling Bits

M442 Fortran Emulation of VM/CMS NAMEFIND Command

Routine ID: M442
Author(s): J. ShiersLibrary: KERNLIB
Submitter: Submitted: 25.07.91
Language: FortranRevised:

NAMEFD is a Fortran callable routine providing an emulation of the VM/CMS NAMEFIND command.

Structure:

SUBROUTINE subprogram
User Entry Names: NAMEFD

Usage:

    CHARACTER*255 CHIN(NIN),CHOUT(NOUT)
    CALL NAMEFD(LUN,CHFILE,CHIN,NIN,CHOUT,NOUT,IRC)
NAMEFD scans the specified file for entries that match the specified input tags and values. It returns the values of the specified output tags. Thus, given the example file shown below, one might call NAMEFD with input tag :NICK, value SNIFFLES and output tags :PHONE and :ADDRESS. If no match is found for the specified input, a code IRC is returned.
    CHIN(1,1)  = ':NICK'
    CHIN(2,1)  = 'SNIFFLES'
    NIN        = 1
 
    CHOUT(1,1) = ':PHONE'
    CHOUT(1,2) = ':ADDRESS'
    NOUT       = 2
 
    CALL NAMEFD(1,'TEST.NAMES',CHIN,NIN,CHOUT,NOUT,IRC)
Return codes:
32 - no match for input tags and values,
4 - not all requested output tags found,
other - IOSTATfrom FORTRAN OPENof specified names file.


Format of a Names File
A names file is a collection of entries, with each entry identied by a nickname. A nickname tag plus a series of other tags with associated values make up an entry.

The format of data lines in a names file is as follows:

    tag.value (:tag.value...)
The only tag that is required is a :NICK tag, e.g.
    :NICK.fatuser
This is the primary tag, one for each entry. It identifies the beginning of an entry and must be the first word on a line. Any tags that follow relate to the preceding :NICK tag.

Examples:

An example of a NAMES file.

  :nick.SNOW     :userid.SNOWHITE :node.FOREST
                 :name.Snow White               :phone.ZZZ-ZZZZ
                 :addr.Forest Primeval
  :nick.SNOOZY   :userid.SNOOZY   :node.COTTAGE
                 :name.I. M. Dozing             :phone.777-7777
                 :addr.Dwarf Cottage;Forest
  :nick.DUMMY    :userid.DUMMY    :node.COTTAGE
                 :name.S. A. What               :phone.777-7777
                 :addr.Dwarf Cottage;Forest
  :nick.BOSS     :userid.BOSS     :node.COTTAGE
                 :name.T.O.P. Banana            :phone.777-7777
                 :addr.Dwarf Cottage;Forest
  :nick.SNIFFLES :userid.SNIFFLES :node.COTTAGE
                 :name.A. H. Choo               :phone.777-7777
                 :addr.Dwarf Cottage;Forest
  :nick.GROUCHY  :userid.GROUCHY  :node.COTTAGE
                 :name.E. B. Scrooge            :phone.777-7777
                 :addr.Dwarf Cottage;Forest
  :nick.SMILEY   :userid.SMILEY   :node.COTTAGE
                 :name.H. A. Haas               :phone.777-7777
                 :addr.Dwarf Cottage;Forest
  :nick.WISTFUL  :userid.WISTFUL  :node.COTTAGE
                 :name.R. U. Shy                :phone.777-7777
                 :addr.Dwarf Cottage;Forest
  :nick.WITCH    :userid.QUEEN    :node.CASTLE
                 :name.Bad Queen                :phone.UGLY-1111
                 :addr.Vanity Lane;Mirror City
  :nick.GORGEOUS :userid.PRINCE   :node.ATLARGE :notebook.PRIVATE
                 :name.Prince Charming          :phone.Area 111 111-1111
  :nick.DWARFS
                 :list.SNOOZY DUMMY BOSS SMILEY GROUCHY SNIFFLES WISTFUL

M501


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995