File Information

Addtdlitho File : ADDTDLITHO.DBG

environment coal
! THIS SCRIPT CREATES A NEW DATABASE ABCNEW.GEO A COPY OF ABCNICK.GEO
! WITH ADDITIONAL LITHO RECORDS IF THE LAST LITHO DOES NOT EXTEND TO 
! THE TOTAL DEPTH OF THE HOLE. 
! THIS SCRIPT ONLY COPIES THE survey AND LITHO RECORDS. IF YOU HAVE 
! MORE THAN ONE RECORD TYPE YOU WILL HAVE TO COPY THESE AS WELL
! YOU WILL HAVE TO EDIT THE DATABASE NAMES
! CHANGE 'LOCATE' TO THE HEADER RECORD
! CHANGE 'LITHO' TO THE LITHO RECORD
! CHANGE ALL FIELD NAMES
using database rusknotd.geo/geo alias db 
define initialize
  always
    lastdepth = 0 ;
    lasttd = 0 ;
    addtd = FALSE ;
    stop "Initialization complete".
end of initialize definition
generate rusk.geo/geo alias newdb 
  if addtd and ( no_more_data(db) or current_record(db:survey) ) and lastdepth lt lasttd then
    output! =    "Adding TD record for hole " & hole
               & " td " & format(lasttd,"F7.3") 
               & " depth " & format(lastdepth,"F7.3") ;
! IF YOU HAVE FROM'S AND TO'S UNCOMMENT AND EDIT THE NEXT LINE
    newdb:lith:from = lastdepth ;
    newdb:lith:to = lasttd ;
    newdb:lith:seam = ' ' ;
!   newdb:lith:rock = ' ' ;
    save newdb:lith.
  if addtd and ( no_more_data(db) or current_record(db:survey) ) and lastdepth ge lasttd then
    output! =    "Last record matches TD for hole " & hole 
               & " td " & format(lasttd,"F7.3") 
               & " depth " & format(lastdepth,"F7.3").
  if no_more_data(db) then
    stop "End of db fix".
  if current_record(db:survey) then
    hole = db:survey:dhid ;
    output! = "Scanning hole " & hole ;
    addtd = TRUE ;
    lastdepth = 0 ;
    lasttd = db:survey:td ;
    newdb:survey = db:survey ;
    save newdb:survey.
  if current_record(db:lith) then
    lastdepth = db:lith:to ;
    newdb:lith = db:lith ;
    save newdb:lith.
! UNCOMMENT THIS LINE AND EDIT IF YOU HAVE RECORDS OTHER THAN LITHO
! ADD ADDITIONAL COPY STATEMENTS AS NEEDED
  if current_record(db:qual) then
     newdb:qual = db:qual ;
     save newdb:qual.
  always 
    read db.
end of ? generation