Coastal & Marine Geology InfoBank

Home FACS Activities Atlas Geology School Related Sites More

USGS InfoBank program -- yesno

Skip navigational links
Loading
InfoBank Programs: by Name   by Topic  
Expanded Description
Topic Description
Name
yesno
Synopsis
/infobank/programs/share/yesno.for
Description
  Subroutine to return the response to a prompt from the calling program

  that can be answered by a single character. 
       
COMMENTS
  It read the users answer, checks to see if it falls within known

  limits, and returns the one character response indicating the results.
    
  A list of acceptable responses are passed to the subroutine.
    
  If a default response is acceptable, surround the respnse with [ ]
  
  Any other response is unrecognized. Responses can be in either
  capital or small letters.
      
    
USAGE
  "a" = argument, "r" = referenced, "s" = set

  
  call yesno                            (with the following arguments)
         Acceptable                  [variable char*(*) r]
         Response                    [variable char*1 asr]
  
  Input:
     Acceptable = character string of allowed answers.
  Output:
     Response = a one character capital letter response.
     
    
PROMPTS
  None


    
SUBROUTINES
  changecase          (shared DRS external routine) 

  stringlen           (shared DRS external routine) 
        
    
FUNCTIONS
  index               (FORTRAN intrinsic function)  

        
    
FILES_USED
  unit=6(write)

  unit=*(read,write)
        
    
PROGRAMMING_CONSIDERATIONS
  Any program calling this subroutine should be able to handle all of

  the response flag values.  However, this does not mean the program
  must have a help facility.  If it doesn't, it should consider the 'H'
  response as invalid and loop back to query the question again. A
  possible code segment to handle YESNO might look something like:
  
  print *, '<some-question> (Y, [N
  call yesno ('Y[N]H', Response)
          
    
DISCLAIMER
  Although this program has been used by the U.S. Geological Survey,

  no warranty, expressed or implied, is made by the Survey as to the
  accuracy and functioning of the program and related program
  material nor shall the fact of distribution constitute any such
  warranty, and no responsibility is assured by the Survey in
  connection therewith.
          
    
AUTHOR
  Clint Steele           .for

  Ed Maple   8/28/87
      Modified to handle help and unrecognized responses. Also puts
      the responsibility of reprompting of an unrecognized response
      on the calling program. Also changed returned argument to a
      character variable.
  Jean Riordan 1/18/88     Modified for DRS$SHARE cleanup and 
                             UNIX compatibility
  Clint Steele   3/7/88    Added ability to pass default values.
  Clint Steele   9/27/88   Changed * i/o to units 5 and 6
  Clint Steele   9/30/88   Changed input from unit 5 to *

    
Reads
      read (*, '(a1)') Response
Writes
              write (6, '(4x,a1)') (CapitalAccept 
     *             (LoopCount:LoopCount), LoopCount = 1, Length)
Opens
Calls
      call changecase ('CAPITAL', CapitalAccept)
      call stringlen  (CapitalAccept, Length)
          call changecase ('CAPITAL', Response)

Skip footer navigational links

Coastal and Marine Science Centers:  Pacific   St. Petersburg   Woods Hole  
InfoBank   Coastal and Marine Geology Program   Geologic Information   Ask-A-Geologist   USGS Disclaimer  


Accessibility FOIA Privacy Policies and Notices

Take Pride in America logo USA.gov logo U.S. Department of the Interior | U.S. Geological Survey
URL: http://walrus.wr.usgs.gov/infobank/programs/share/yesno.doc.html
Page Contact Information: InfoBank staff
Page Last Modified: Mon Sep 16 03:36:57 PDT 2013  (chd)