1
! @(#)catalb.prg 19.1 (ESO-DMD) 02/25/03 14:08:44
2
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
! MIDAS procedure catalb.prg for CREATE, SET, CLEAR/xCAT
6
! K.Banse 910121, 920908, 970102, 990706, 000523
8
! use as CREATE/xCAT cat_name [dir_specs] [cat_descr]
12
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14
define/local action/c/1/3 {mid$cmnd(1:3)} !save command for catal.exe
15
define/local cattyp/c/1/1 {mid$cmnd(11:11)} !save catalog type
17
define/local ioff/i/1/2 0,0
18
define/local mycat/c/1/{catalinf(11)} " " ALL
20
if cattyp .eq. "I" then !Images
21
if mid$cmnd(12:12) .eq. "M" then
26
define/param p1 icatalog.cat I "Enter name of catalog:"
27
define/local name/c/1/5 image
28
define/local filtyp/c/1/3 bdf
31
elseif cattyp .eq. "T" then !Tables
32
define/param p1 tcatalog.cat I "Enter name of catalog:"
33
define/local name/c/1/4 table
34
define/local filtyp/c/1/3 tbl
37
elseif cattyp .eq. "F" then !Fit files
38
define/param p1 fcatalog.cat I "Enter name of catalog:"
39
define/local name/c/1/8 fit_file
40
define/local filtyp/c/1/3 fit
43
elseif cattyp .eq. "A" then !ASCII files
44
define/param p1 acatalog.cat I "Enter name of catalog:"
45
define/local name/c/1/5 ASCII
46
define/local filtyp/c/1/3 "* "
53
inputi = m$index(p1,"*") + m$index(p1,"?") !avoid create/xcat lola*.bdf ...
59
inputi = ioff(2) !save catalog type in INPUTI
60
ioff = catalinf({inputi})
63
if m$ftset(p1) .ne. 1 then
64
write/keyw mycat {p1}.cat
71
if mid$cmnd(1:2) .eq. "CL" then
72
catalinf({ioff(2)}) = 0
73
write/keyw catalogs/c/{ioff}/{catalinf(11)} " " ALL
79
! here for SET/xCAT cat_name
80
! -------------------------
81
if mid$cmnd(1:2) .eq. "SE" then
82
catalinf({ioff(2)}) = 1
83
write/keyw catalogs/c/{ioff}/{catalinf(11)} {mycat}
84
write/out "Catalog {mycat} now the active {name} catalog."
85
if m$exist(mycat) .ne. 1 -
86
write/out "Warning: Catalog {mycat} does not exist yet..."
90
! as default here for CREATE/xCAT
91
! -------------------------------
92
define/param p2 + C "Enter file_specs, e.g. as3*.bdf: "
93
define/param p3 IDENT C "Enter char. descr used for Ident field:"
95
if aux_mode .lt. 2 then !in VMS we do purge ...
96
$DELETE/NOLOG/NOCONF {mycat}.* !try to delete catalog first
97
$DELETE/NOLOG/NOCONF dirfile.ascii.* !try to delete dirfile.ascii
98
if error(2) .lt. 2 then
99
write/out "We now try to purge the relevant files"
101
"Please, ignore all Error/Warning messages from the operating system ..."
106
if m$exist(mycat) .eq. 1 $rm -f {mycat} !try to delete catalog first
107
$rm -f dirfile.ascii !try to delete dirfile.ascii
110
write/keyw in_b " " all !clear keyword IN_B first
111
if p2(1:1) .eq. "+" then
112
write/keyw in_b *.{filtyp}
117
if in_b(1:4) .ne. "NULL" then !if root is given, build from there
118
ioff = m$index(in_b,",:") !check, if table,:label specified
119
if ioff .lt. 1 ioff = m$index(in_b,",#")
123
ioff = m$index(in_b,".ascii") !check, if file.ascii
125
if aux_mode .lt. 2 then !VMS
126
$DIREC/SIZE/OUT=dirfile.ascii {in_b}
128
out_b = m$repla(in_b,","," ") !replace all `,' by ` '
129
$ls {out_b} > dirfile.ascii
132
if in_b .ne. "dirfile.ascii" then
133
-copy {in_b} dirfile.ascii