Viewing contents of file '../idllib/iuedac/iuelib/pro/con_db.pro'
;******************************************************************************
;+
;*NAME:
;
; CON_DB
;
;*PURPOSE:
;
; Converts database files to a format compatible with the host
; operating system. CON_DB can convert files created with IDBCREATE
; to the appropriate format for the host operating system.
;
;*CALLING SEQUENCE:
;
; CON_DB,NAME,cpupar
;
;*PARAMETERS:
;
; NAME (REQ) (I) (0) (S)
; File name of .dbd file (without .dbd extension)
; Corrected data is written over original file on
; unix systems.
;
; CPUPAR (OPT) (I) (I) (0)
; Parameter to identify data translation mode.
;
; no conversion 0
;
; VAX to MIPSEL 1 not available
; MIPSEL to VAX 2 not available
;
; VAX to SPARC 3
; SPARC to VAX 4
;
; MIPSEL to SPARC 5 not available
; SPARC to MIPSEL 6 not available
;
; Supported Data Types:
;
; VAX - VAXstations, MicroVAX
; MIPSEL - DECstations, IBM 386 not available
; SPARC - SparcStations, Sun 4##
;
; Note: No Conversion is required between like data types,
; such as DECstations and IBM 386s.
;
; If CPUPAR is not given in the call, the user will be
; prompted for it.
;
; Note that only two modes are allowed for a given machine.
; The allowed modes are those in which the final data format
; is compatible with the host operating system.
;
;*RESTRICTIONS:
;
; Conversion to/from MISPEL systems are not available.
;
; Not for use with fits forrmatted files.
;
;*SUBROUTINES CALLED:
;
; PARCHECK
; CHKFITS
; IDBSUNTOHOST
; IDBVAXTOSUN
; IDBCREATE
; IDBOPEN
; IDBCLOSE
; IDBINDEX
; CONMENU
; MULDIRFF
; DECOMPOSE
;
;*SYSTEM VARIABLES USED:
;
; !iuepriv
; !iuer.database
;
;*EXAMPLES:
;
; to convert the IUELOG database:
; !iuepriv = 2
; con_db,'iuelog'
; The system variable !iuer.database must have been set to point to the
; current directory.
;
;*NOTES:
;
; Before execution copy the <name>.dbd and <name>.dbf files
; from the VAX to the SUN or from the SUN to the VAX.
;
;*PROCEDURE:
;
; CON_DB uses the CONMENU procedure to determine the host
; operating system and cpu architecture. The allowed conversion
; options are then defined based on the operating system and cpu
; type. The user is asked to select from the allowed conversion
; options.
;
;*MODIFICATION HISTORY:
;
; 4 Sep 92 PJL wrote CON_DB based on CON_SAV
; 20 Oct 92 PJL added indexing for SUN to VAX conversion; added
; resetting !iuepriv to 1
; 27 Oct 93 PJL SunOS to Dec Ultrix conversion permitted
; 15 Nov 93 PJL added CHKFITS
; 9 Jun 94 PJL replaced !version with CONMENU
; 2 Sep 94 LLT replace IUER_MLOG with !iuer.mlog
; 2 Nov 94 PJL added MULDIRFF; changed !iuer.mlog to !iuer.database
;
;-
;******************************************************************************
pro con_db,name,cpupar
;
npar = n_params(0)
if (npar eq 0) then begin
print,'CON_DB,NAME,cpupar'
retall
endif ; npar eq 0
parcheck,npar,[1,2],'CON_DB'
;
print,'Please note, VAX to MIPSEL, MISPEL to VAX, and MISPEL to SPARC'
print,'conversion options are not currently available.'
print,'Sorry for any inconvenience this causes.'
print,' '
answer = ''
read,'Please press RETURN to continue. ',answer
conmenu,cpupar
;
; file file(s)
;
muldirff,!iuer.database,tdirs,tct,tnames,srch_string=name+'.*'
if (total(tct) gt 0) then begin
decompose,tnames(0),tempdisk,temppath,tempname,tempext,tempver
dbname = tempdisk + temppath + tempname
endif else begin
print,'Unable to find database ' + strupcase(name)
print,'ACTION: retall'
retall
endelse ; total(tct) gt 0
;
; make sure files are not fits format
;
chkfits,dbname+'.dbd',newsips,/silent
if (newsips) then begin
print,name + '.dbd is a fits formatted file. No conversion will be done.'
print,'ACTION: return'
!iuepriv = 1
return
endif ; newsips
;
chkfits,dbname+'.dbf',newsips,/silent
if (newsips) then begin
print,name + '.dbf is a fits formatted file. No conversion will be done.'
print,'ACTION: return'
!iuepriv = 1
return
endif ; newsips
;
; perform the conversion
;
case cpupar of
1: print,'Sorry VAX to MIPSEL option not available.'
2: print,'Sorry MISPEL to VAX option not available.'
3: begin
idbcreate,name,1
idbvaxtosun,name
idbopen,qdb,qitems,qdbrec,name,1
idbindex,qdb,qitems,qdbrec
idbclose,qdb,qitems,qdbrec
print,'VAX to SPARC conversion completed.'
end ; 3
4: begin
idbsuntohost,name
idbopen,qdb,qitems,qdbrec,name,1
idbindex,qdb,qitems,qdbrec
idbclose,qdb,qitems,qdbrec
print,'SPARC to VAX conversion completed.'
end ; 4
5: print,'Sorry MISPEL to SPARC option not available.'
6: begin
idbsuntohost,name
idbopen,qdb,qitems,qdbrec,name,1
idbindex,qdb,qitems,qdbrec
idbclose,qdb,qitems,qdbrec
print,'SPARC to MISPEL conversion completed.'
end ; 4
endcase ; cpupar
;
!iuepriv = 1
;
return
end ; con_db