~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to prim/proc/catalb.prg

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
! @(#)catalb.prg        19.1 (ESO-DMD) 02/25/03 14:08:44
 
2
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
3
!
 
4
! MIDAS procedure  catalb.prg   for CREATE, SET, CLEAR/xCAT
 
5
!
 
6
! K.Banse    910121, 920908, 970102, 990706, 000523
 
7
!
 
8
! use as CREATE/xCAT cat_name [dir_specs] [cat_descr]
 
9
!        SET/xCAT    cat_name 
 
10
!        CLEAR/xCAT  
 
11
!
 
12
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
13
!
 
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
 
16
!
 
17
define/local ioff/i/1/2 0,0
 
18
define/local mycat/c/1/{catalinf(11)} " " ALL
 
19
!
 
20
if cattyp .eq. "I" then                 !Images
 
21
   if mid$cmnd(12:12) .eq. "M" then
 
22
      write/error 3
 
23
      return/exit
 
24
   endif
 
25
 
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
 
29
   ioff(2) = 1
 
30
 
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
 
35
   ioff(2) = 3
 
36
 
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
 
41
   ioff(2) = 4
 
42
 
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 "*  "
 
47
   ioff(2) = 2
 
48
else
 
49
   write/error 3
 
50
   return/exit
 
51
endif
 
52
 
53
inputi = m$index(p1,"*") + m$index(p1,"?")   !avoid create/xcat lola*.bdf ...
 
54
if inputi .gt. 0 then
 
55
   write/error 100
 
56
   return/exit
 
57
endif
 
58
 
59
inputi = ioff(2)                        !save catalog type in INPUTI
 
60
ioff = catalinf({inputi})
 
61
ioff(2) = ioff(2) + 5
 
62
 
63
if m$ftset(p1) .ne. 1 then
 
64
   write/keyw mycat {p1}.cat
 
65
else
 
66
   write/keyw mycat {p1}
 
67
endif
 
68
 
69
!  here for CLEAR/xCAT
 
70
!  -------------------
 
71
if mid$cmnd(1:2) .eq. "CL" then
 
72
   catalinf({ioff(2)}) = 0
 
73
   write/keyw catalogs/c/{ioff}/{catalinf(11)} " " ALL
 
74
   return
 
75
endif
 
76
!
 
77
write/keyw in_a {p1}
 
78
!
 
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..."
 
87
   return
 
88
endif
 
89
!
 
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:"
 
94
 
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"
 
100
      write/out -
 
101
      "Please, ignore all Error/Warning messages from the operating system ..."
 
102
   endif
 
103
   $PURGE *.{filtyp}
 
104
 
105
else
 
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
 
108
endif
 
109
 
110
write/keyw in_b " " all                 !clear keyword IN_B first
 
111
if p2(1:1) .eq. "+" then
 
112
   write/keyw in_b *.{filtyp}
 
113
else
 
114
   write/keyw in_b {p2}
 
115
endif
 
116
 
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,",#")
 
120
   if ioff .gt. 1 then
 
121
      default(1:1) = "T"
 
122
   else
 
123
      ioff = m$index(in_b,".ascii")             !check, if file.ascii
 
124
      if ioff .lt. 1 then
 
125
         if aux_mode .lt. 2 then                !VMS 
 
126
            $DIREC/SIZE/OUT=dirfile.ascii {in_b}
 
127
         else                                   !Unix
 
128
            out_b = m$repla(in_b,","," ")       !replace all `,' by ` '
 
129
            $ls {out_b} > dirfile.ascii
 
130
         endif
 
131
      else
 
132
         if in_b .ne. "dirfile.ascii" then
 
133
            -copy {in_b} dirfile.ascii
 
134
         endif
 
135
      endif
 
136
      default(1:1) = "Y"                
 
137
   endif
 
138
else
 
139
   default(1:1) = "N"           
 
140
endif
 
141
!
 
142
run MID_MONIT:catal