1
/*===========================================================================
2
Copyright (C) 1993-2009 European Southern Observatory (ESO)
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public
15
License along with this program; if not, write to the Free
16
Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
19
Corresponding concerning ESO-MIDAS should be addressed as follows:
20
Internet e-mail: midas@eso.org
21
Postal address: European Southern Observatory
22
Data Management Division
23
Karl-Schwarzschild-Strasse 2
24
D 85748 Garching bei Muenchen
26
===========================================================================*/
28
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
32
..AUTHOR IPG-ESO Garching
33
..CATEGORY Data Organizer utilities
34
..COMMENTS This module implements the following Midas commands:
37
\item {\tt CREATE/RULE table rule
41
..VERSION 1.0 15-Mar-1993 Definition M. Peron
44
-----------------------------------------------------------------*/
49
#include <midas_def.h>
56
extern int decrypt1(), tbl_hist();
60
"TBLENGTH","TBLOFFST","TBLCONTR","TSELTABL",
65
int status,tid,tid0,nrow,nicol;
66
int null, len, lennew, dummy;
69
char line[40],column[1+TBL_LABLEN];
70
char selecrit[256],outdescr[8],action[2];
71
char intable[60],label[1+TBL_LABLEN];
72
char temptable[60],*temp,text[60];
76
strcpy(temptable,"TEMP_TAB");
77
SCKGETC("ACTION",1L,1L,&dummy,action);
78
SCKGETC("INPUTC",1L,8L,&dummy,outdescr);
80
if ((n = stuindex(outdescr,mystand[i])) == 0 ){
81
sprintf(text,"Error writing in standard descriptor: %s",outdescr);
84
SCKGETC("IN_A",1L,60L,&dummy,intable);
85
TCTOPN(intable,F_IO_MODE,&tid0);
86
if (action[0] == 'C') {
87
TCIGET(tid0,&nicol,&dummy,&dummy,&dummy,&dummy);
88
TCTINI("TEMP_TAB",F_TRANS,F_IO_MODE,2,nicol,&tid);
89
TCCINI(tid,D_C_FORMAT,13L,"A13"," ","COLUMN",&colc);
90
for (i=0; i<nicol; i++) {
91
TCLGET(tid0,i+1,label);
92
TCEWRC(tid,i+1,1L,label);
94
TCCINI(tid,D_C_FORMAT,40L,"A40"," ","RULE",&colr);
97
TCTOPN(temptable,F_I_MODE,&tid);
98
TCIGET(tid,&dummy,&nrow,&dummy,&dummy,&dummy);
99
SCKGETC("INPUTC",1L,8L,&dummy,outdescr);
101
oscfill(selecrit,256,'\0');
102
for (i=0; i<nrow; i++) {
103
status = TCERDC(tid,i+1,2L,line,&null);
106
TCERDC(tid,i+1,1L,column+1,&null);
107
if (selecrit[0] != '\0') strcat(selecrit,".AND.");
108
decrypt1(column,line,selecrit,temp);
109
lennew = strlen(selecrit);
112
SCDWRC(tid0,outdescr,1L,selecrit,1L,lennew,&unit);