2.4 XAS procedures


XAS is not Yet Another Scripting Language and does not explicitly supports the writing of procedure scripts, but defers this to the facilities provided by the various operating systems (e.g. shell scripts or DCL command files), with which the user is perhaps more familiar.

We give here only a brief tutorial on the possibilities of assembling sequences of XAS commands to perform repetitive tasks (with particular emphasis on the Unix side).


Simple sequences

If one needs to execute often a standard sequence of XAS commands to perform a standard reduction, using always the same standard file names, without need to pass any argument, and without the need of "branching" (no IF statements depending on previous results), it is sufficient

Parametric sequences

By "parametric" sequence we mean a standard sequence of XAS commands used to perform a standard reduction, without the need of "branching" (no IF statements depending on previous results), but which requires some arguments (e.g. file names or numeric parameters).

This can be arranged as an executable shell script with arguments, or even as a "source" file by setting the arguments in specific shell environment variables. The same concepts given above for simple sequences are valid here too, provided one does not need to access the XAS environment at shell level.

Note also that, if one wishes to supply some arguments interactively, one can use a simple sequence containing XAS commands (and invocation of command files ) in which some runstring or command file arguments are left "blank" and will therefore be prompted interactively.

Procedure scripts

One will need to write a proper script under two conditions : Programming is left to the facilities of the user's favourite shell and is not of our concern here.
Coming to the interaction of the XAS and system variables one shall instead note what follows.

Other useful Unix tricks

One can, if desired, access directly the content of the file where the environment is stored. This file is in the user login directory, and has a name linked to the current terminal name (e.g. ttyp1) and to the hostname (e.g. poseidon), like ttyp1_poseidon.environment.

One may then use also a command of the following form to copy back a XAS environment variable into a shell variable :

set fotdirname = `grep FOTDIR ~/ttyp1_poseidon.environment | cut -f2 -d'='`
Note also that the environment files remain there after you log off, but are in general cleared when you log in again and issue your first XAS command in the new session. If you wish to continue preserving the last session XAS environment, just touch the environment file before issuing ANY XAS command.
A similar effect is obtained if you copy or rename the environment file of a session into another.

[Previous][Next] [Up][Down]

sax.iasf-milano.inaf.it/Xashelp/xasprog.4.html :: original creation 2002 Sep 04 17:38:28 CEST :: last edit 2002 Sep 04 17:38:28 CEST