Coastal & Marine Geology InfoBank

Home FACS Activities Atlas Geology School Related Sites More

USGS InfoBank program -- opener

Skip navigational links
Loading
InfoBank Programs: by Name   by Topic  
Expanded Description
Topic Description
Name
opener
Synopsis
/infobank/programs/share/opener.for
Description
  Subroutine to prompt for input file names and opens input and output files

  naming output files with the same prefix as the last input file and
  with suffixes supplied by the calling program.
       
PROCESS
  (a modification of OPENEM)

  A negative second argument instructs OPENER not to put a 
  DRS header in the output files.
    
USAGE
  "a" = argument, "r" = referenced, "s" = set

  
  call opener                           (with the following arguments)
         NumberInput                 [variable i*4 ar]
         NumberOutput                [variable i*4 ar]
         SuffixList                  [variable char*1 r]
    
SUBROUTINES
  getprcnam           (shared DAPS external routine)

  getusrnam           (shared DAPS external routine)
  changecase          (shared DAPS external routine)
  stringlen           (shared DAPS external routine)
  getarg              (shared DAPS external routine)
  getfile             (internal)                    
  command             (shared DAPS external routine)
  getjpihed           (shared DAPS external routine)
  starin              (shared DAPS external routine)
  getdevice           (internal)                    
  forerror            (shared DAPS external routine)
  parsename           (shared DAPS external routine)
  starout             (shared DAPS external routine)
  header              (shared DAPS external routine)
    
FUNCTIONS
  lib$spawn           

  index               (FORTRAN intrinsic function)  
  len                 (FORTRAN intrinsic function)  
  abs                 (FORTRAN intrinsic function)  
    
FILES_USED
  unit=*(read,write)

  unit=6(write)
  unit=(l)unitnumber(open,inqre)
  atement
  is
  present

    
Reads
                      read (*, '(a)') FileName
                      read (*, '(a)') FileName
Writes
                      write (6, 500) Counter (LoopCount),
     *                    Additional(1:LengthAdd)
                      write (6, 510) Additional(1:LengthAdd)
Opens
                      open (unit   = UnitNumber, 
     *                      form   = 'FORMATTED',
     *                      status = 'OLD', 
     *                      file   = FileName,
     *                      iostat = ErrorFlag, 
     *                      recl   = RecordLength)
                      open (unit   = UnitNumber, 
     *                      form   = 'FORMATTED',
     *                      status = 'OLD', 
     *                      file   = FileName,
     *                      iostat = ErrorFlag, 
     *                      recl   = RecordLength) 
                  open (unit = UnitNumber, 
     *                  form = 'FORMATTED',
     *                  status = 'NEW', 
     *                  file = FileName, 
     *                  iostat = ErrorFlag) 
Calls
      call getprcnam (ProcessName)
      call getusrnam (UserName)
      call changecase ('CAPITALS', UserName)
      call stringlen (UserName, LengthUser)
      call stringlen (Additional, LengthAdd)
          call getarg (-2, FileName)
              call getfile (-2, NumberInput, FileName, NameLength)
                      call command
                  call getjpihed (ProgramName)
                  call starin (FileName)
                  call getdevice (FileName, DeviceType)
                          call forerror (ErrorFlag)
                          call forerror (ErrorFlag)
                          call parsename (LastFile, Node, LengthNode,
     *                                   Device, LengthDevice,
     *                                   Directory, LengthDirectory,
     *                                   SubDirectory, LengthSubDir,
     *                                   SubDirCount, FilePrefix,
     *                                   LengthPrefix, FileType,
     *                                   LengthType, Version,
     *                                   LengthVersion)
          call getarg (-1, FileName)
              call getfile (-1, AbsOutput, FileName, NameLength)
                      call command
                  call getjpihed (ProgramName)
                  call starout (LastFile, FileName)
                      call forerror (ErrorFlag)
      call header (NumberInput, NumberOutput)

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/opener.doc.html
Page Contact Information: InfoBank staff
Page Last Modified: Mon Sep 16 03:36:53 PDT 2013  (chd)