next up previous contents index
Next: MIDAS Data Structures Up: Monitor and Command Language Previous: Starting the MIDAS Monitor

MIDAS And the Host Operating System

Care has been taken that MIDAS and the Host Operating System (DCL for VMS and Bourne or C-shell for Unix) co-exist smoothly and complement each other. Migration from one environment to the other is simple:
If you are in the MIDAS environment, type BYE to switch back to the Host System.
If you have returned to the host environment from a MIDAS session, (indicated by the $-prompt in VMS, and by $ or % in Unix), type GOMIDAS (in VMS) or gomidas  (in Unix) to revive MIDAS. The status of the keywords and the command buffer of the stopped
MIDAS session are preserved - if you want to start afresh, use INMIDAS (VMS)
or inmidas (Unix) again.
You may also use host commands directly inside MIDAS by preceding them with `$'. For instance,
Midas 027> $DIR (in VMS) or
Midas 027> $ls (in Unix)
will display the contents of the current directory.
Please, note, that currently this mode of operation will only invoke Bourne shell  commands in Unix, not C-shell or Kornshell commands. To execute C-shell (or any other Shell) commands you have to insert them in a Bourne shell script which has as the first line: $\char93 $! /bin/csh, or $\char93 $! /bin/ksh, etc.   

If you work on a VMS system, beware of DCL command procedures:
DCL modifies command I/O streams when executing a procedure. This causes problems for the interprocess communication inside MIDAS. When executing a DCL procedure via   $ @ `procedure'   the correct settings will be maintained inside MIDAS.
However assigning a symbol MIMI to the command above and then executing the DCL procedure by just typing $ MIMI will lead to disaster from which only a BYE and subsequent GOMIDAS will get you going again.
Since images, tables, etc. are standard disk files, all host commands related to file operations can be employed. However, if a MIDAS catalog  is used, care has to be taken that the information in the catalog is not invalidated, when e.g. renaming or deleting data files outside MIDAS (i.e. using commands of the host file system directly).

The output  from MIDAS commands can be redirected to ASCII files enabling easy combination of MIDAS and host commands. E.g.
Midas 123> READ/DESCR myimage * >dsc.dat
will send all the output from the READ/DESCR command to the ASCII file dsc.dat (created in your current work directory) which can then be used by any host command. For example,
Midas 124> $EDIT dsc.dat (in VMS) or
Midas 124> $vi dsc.dat (in Unix)

This mechanism is pretty much like the one used in Unix with the exception that there should be no space between the > and the output file name. Furthermore, this output redirection also works on VMS.
Midas 125> STATISTICS/IMAGE myimage >dsc.dat
always creates a new file dsc.dat, if you want to append data to an existing ASCII file use
Midas 126> STATISTICS/IMAGE myimage >>dsc.dat
Midas 126> STATISTICS/IMAGE myimage >Null
will suppress the output. If the keyword LOG(12) = 0 (the default), the suppressed output is still written to the Midas logfile; if LOG(12) = -1, also the logging is suppressed.
As you may have guessed already, there is also input redirection. E.g.
Midas 127> $ls a*.bdf >dscin.dat
Midas 128> READ/DESCR <dscin.dat
will display the standard descriptors of all Midas images with names beginning with the letter `a' in the current directory.
Again there should be no space between < and the file name.
See also the subsection 3.4.5 for more info about I/O redirection.
On a Unix system you can connect MIDAS and Unix command via the pipe symbol  , e.g.
Midas 129> READ/DESCR myimage * | $grep NGC425
Midas 130> $ls a*.bdf | read/descr

next up previous contents index
Next: MIDAS Data Structures Up: Monitor and Command Language Previous: Starting the MIDAS Monitor
Petra Nass