Link to USGS home page
USGS Home
Contact USGS
Search USGS
Coastal & Marine Geology InfoBank

USGS InfoBank program -- skipnsave

Skip navigational links
Search InfoBank
Home tab Atlas tab Activities tab FACS tab Geology School tab More tab Activities tabs
   
InfoBank Programs: by Name   by Topic  
   
Expanded description
Topic Description
Name
skipnsave
Synopsis
/infobank/programs/edit/skipnsave/skipnsave.for
Description
  Program to edit data based on pairs of control times.
    
Comments
  A line number may be added to the output data at the discretion of the

    user starting in column 48. It is read from the control file.
  Data is skipped or saved based on the value of a control code read from
    the control file. 
  If the control code in the first record of a pair of control records is 
    7 or SAVE or START or 1, then data occuring outside of the control 
    block is skipped while data inside the control block is saved. 
  If the control code is 8 or SKIP or END or 0 the reverse is executed.  
  The skipped data may be saved in a separate file.  
  For NAVPLT purposes, zero latitude and longitudes may be placed between 
    sections in both output files.
    
Prompts
  Add line numbers to output? (Y or N)

  Put zero lat/lon between sections? (Y or [N])
  Save skip data in separate file? (Y or [N])
  First  INPUT  file = CONTROL file
  Second INPUT  file = DATA    file
  First  OUTPUT file = SAVE data
       (if you save skip data...)
  Second OUTPUT file = SKIP data
  Enter input  file #1 name:
  Enter input  file #2 name:
  Enter output file #1 name:
       (if you save skip data...)
  Enter output file #2 name:
    
Subroutines
  readata     (internal)

  writedata   (internal)
  openem      (external shareable)
  converttime (external shareable)
  forerror    (external shareable)
  yesno       (external shareable)
    
Authors
  Ed Maple  11/22/85

     based on a previous version by Carolyn Degnan  11/16/84
    
  This version cleaned up and improved so that:
  1) User has option of including line number in the output.
  2) Control codes which were ignored by the previous version
     are used by this new version to determine whether data within
     a skipnsave block should be skipped or saved. Whichever is
     determined, the opposite is done with data occurring before,
     after and between blocks.
    
  Ed Maple  8/31/87   Modified for MAT and change to YESNO. 
                      Added call to PERCENTAGE.
  C. Degnan  9/8/87   Added a check to automatically delete empty 
                      output file
  C. Degnan  5/9/89   Added option for saving skipped data in a 
                      separate file and
                      option for adding zero lat/lon between sections
  C. Degnan  6/12/89  Modified action when data time matches the 
                      control key 8 time so that the data record 
                      is "saved" WITH the data that preceeded it
                      instead of being the first data record in 
                      the "skipped" group.
  C. Steele  11/17/92 Added ability to also use skip/save codes of 
                      SAVE, START, SKIP, END, 0, 1
  C. Steele  11/17/92 Changed line number to a line ID
                      (thus allowing letters) and right justify line.
  C. Degnan  02/22/96 Changed input control format
                      to read from x-x-xx-xx.LINES meta file
                      instead of from xxxxxx.13x skipnsave control file.
  C. Degnan  10/02/00 Changed input control format
                      to read from x-x-xx-xx.nav_lines meta file
                      instead of from x-x-xx-xx.LINES meta file.
  C. Degnan  02/05/01 Changed input control format
                      to read from x-x-xx-xx.onoff.lines nav file
                      instead of from x-x-xx-xx.nav_lines meta file.
  C. Steele  06/14/07 Added recognition of ON and OFF.

    
Reads
     read (iskipunit, 400, end = 900)
*        iyr1, iday1, ihr1, imin1, isec1, iten1, aline, codeflag
     read (iskipunit, 400, end = 900)
*        iyr2, iday2, ihr2, imin2, isec2, iten2, aline, codeflag

     read (idataunit, 400, iostat = ierr, end = 900)
*        ilength, iyr, iday, ihr, imin, isec, iten,
*        arest(1:ilength-14)
    
Writes
         write (i1outputunit, zeroformat) zerolat, zerolon
             write (i2outputunit, zeroformat) zerolat, zerolon
     write (ioutputunit, 500)
*    iyr, iday, ihr, imin, isec, iten, 
*    arest(1:22),
*    aline(1:linelength),
*    arest(23:ilength-14) 
     write (ioutputunit, 510) iyr, iday, ihr, imin, isec, iten, 
*       arest(1:ilength-14)
    
Calls
 call yesno ('Y[N]', auseline)
 call yesno ('Y[N]', azerolatlon)
 call yesno ('Y[N]', asaveskip)
     call openem (2, 1)
     call openem (2, 2)
 call readata
*    (iyr1, itime, arest, ilength, icount, ieof, idataunit)
     call changecase ('CAPITAL', codeflag)
     call changecase ('CAPITAL', codeflag)
         call converttime ('COMPRESS', iday1, ihr1, imin1, 
*                          isec1, iten1, icntrl1, ErrorFlag)
         call converttime ('COMPRESS', iday2, ihr2, imin2, 
*                          isec2, iten2, icntrl2, ErrorFlag)

                         call writedata
*    (iyr1, itime, arest, aline, ilength, auseline, i1outputunit)
                         call writedata
*    (iyr1, itime, arest, aline, ilength, auseline, i2outputunit)
                         call writedata
*    (iyr1, itime, arest, aline, ilength, auseline, i1outputunit)
                         call writedata
*    (iyr1, itime, arest, aline, ilength, auseline, i2outputunit)
                 call readata
*    (iyr1, itime, arest, ilength, icount, ieof, idataunit)
         call writedata
*    (iyr1, itime, arest, aline, ilength, auseline, i1outputunit)
         call readata
*    (iyr1, itime, arest, ilength, icount, ieof, idataunit)
         call writedata
*    (iyr1, itime, arest, aline, ilength, auseline, i2outputunit)
         call readata
*    (iyr1, itime, arest, ilength, icount, ieof, idataunit)
         call forerror (ierr)
 call converttime ('COMPRESS', iday, ihr, imin, isec, iten, 
*                  itime, ErrorFlag)

 call converttime ('EXPAND', iday, ihr, imin, isec, iten, itime, 
*                  ErrorFlag)

     call stringlen (aline, linelength)
    

Skip footer navigational links


InfoBank   Menlo Park Center   Santa Cruz Center   St. Petersburg Center   Woods Hole Center   Coastal and Marine Geology Program   Geologic Information   Ask-A-Geologist   USGS Disclaimer  

FirstGov button   Take Pride in America button