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

USGS InfoBank program -- changeactivity

Skip navigational links
Search InfoBank
Home tab FACS tab Activities tab Atlas tab Geology School tab More tab More tab Activities tabs
   
InfoBank Programs: by Name   by Topic  
   
Expanded description
Topic Description
Name
changeactivity
Synopsis
/infobank/programs/util/changeactivity/changeactivity.for
Description
  Program to change an Activity ID.
    
Author
  Clint Steele     2/11/2008


    
Opens
 open (unit = 90,
*      access = 'sequential',
*      form = 'formatted',
*      status = 'old',
*      name = '/tmp/changeactivity.filelist.temp')

 open (unit = 85,
*      access = 'append',
*      form = 'formatted',
*      status = 'unknown',
*      file = '/infobank/programs/keep/changedactivities.keep')

    
Reads
 read (5, '(q,a)', end = 99)
*    OldIDLength, OldShortID(1:OldIDLength)

 read (5, '(q,a)', end = 99)
*    NewIDLength, NewShortID(1:NewIDLength)

     read (90, '(q,a)', end = 98)
*        OldFileLength, OldFile(1:OldFileLength)

    
Writes
 write (85, '(a)')
*    'changed '//CapOldLongID(1:OldIDLength+3)//
*    ' to '//CapNewLongID(1:NewIDLength+3)

    
Calls
 call changecase ('SMALL', OldShortID(1:OldIDLength))
 call changecase ('CAPITAL', CapOldShortID(1:OldIDLength))
 call changecase ('SMALL', NewShortID(1:NewIDLength))
 call changecase ('CAPITAL', CapNewShortID(1:NewIDLength))
 call changecase ('CAPITAL', CapOldLongID(1:OldIDLength+3))
 call changecase ('CAPITAL', CapNewLongID(1:NewIDLength+3))
 call system ('/bin/find /infobank/'//
*             OldShortID(1:1)//'/'//
*             OldShortID(1:OldIDLength)//'*/* -ls > '//
*             '/tmp/changeactivity.filelist.temp')

     call system ('/bin/cat '//
*        OldFile(Slash:OldFileLength)//' | '//
*        'sed -e s/'//
*        OldLongID(1:OldIDLength+3)//'/'//
*        NewLongID(1:NewIDLength+3)//'/g | '//
*        'sed -e s/'//
*        CapOldLongID(1:OldIDLength+3)//'/'//
*        CapNewLongID(1:NewIDLength+3)//'/g | '//
*        'sed -e s/'//
*        OldShortID(1:OldIDLength)//'/'//
*        NewShortID(1:NewIDLength)//'/g | '//
*        'sed -e s/'//
*        CapOldShortID(1:OldIDLength)//'/'//
*        CapNewShortID(1:NewIDLength)//'/g > '//
*        '/tmp/changeactivity.'//
*        NewShortID(1:NewIDLength)//'.temp')

         call system ('/bin/mv '//
*            '/tmp/changeactivity.'//
*            NewShortID(1:NewIDLength)//'.temp '//
*            OldFile(Slash:Slash+OldIDLocation-2)//
*            NewLongID(1:NewIDLength+3)//
*            OldFile(Slash+OldIDLocation+OldIDLength+2:
*            OldFileLength))

         call system ('/bin/rm '//
*            OldFile(Slash:OldFileLength))
 call system ('/bin/mv '//
*    '/infobank/'//
*    OldShortID(1:1)//'/'//OldShortID(1:OldIDLength)//' '//
*    '/infobank/'//
*    NewShortID(1:1)//'/'//NewShortID(1:NewIDLength))

 call system ('/bin/rm /tmp/changeactivity.'//
*    NewShortID(1:NewIDLength)//'.temp')

    

Skip footer navigational links


InfoBank   Menlo Park & Santa Cruz Centers   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