aboutsummaryrefslogtreecommitdiff
path: root/pkg/system/doc/mkscript.hlp
blob: 5aa332046d9973538ed286c615680b1f21dc248c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
.help mkscript Nov85 system
.ih
NAME
mkscript -- make a script for a command sequence to be run in batch
.ih
USAGE	
mkscript script task submit
.ih
PARAMETERS
.ls script
Script file name.  Commands will be successively added to this file.
.le
.ls task   
Task name of command to be added to the script.  If given on the command
line then only commands for this task may be added to the script.
If not given on the command line then the task will query for a task
name for each new command.  Currently the task name must not be abbreviated.
.le
.ls submit
Submit the completed script as a background job as the last act of the task?
If not given on the command line the task will query before submitting the
script.
.le
.ls append = no
Append new commands to an existing script file?
If no the file will be deleted first.   If \fIverify\fR = yes
the user will be asked to confirm the deletion.
.le
.ls hidden = yes
Include hidden parameters in each command?
.le
.ls verify = yes
Verify each command, any file deletions, and the final script?
.le
.ls logfile = "script.log"
Script log file name.  When the script is submitted as a background job
by this task any command and error output is directed to this file.
.le
.ih
DESCRIPTION
A command script is created consisting of a number of commands to be
executed sequentially.  The task assumes the responsibility of formatting
the command and placing it in the script file.  The user sets the
parameter values using the parameter editor \fBeparam\fR.  As an optional
final stage the task will optionally submit the script as a background job.

The sequence of steps are outline as follows:
.ls (1)
If the script already exists and \fIappend\fR = no the script file
is deleted.  When \fIverify\fR = yes the deletion is verified with the
user.
.le
.ls (2)
If the task is not specified on the command line then the user
is queried for a task name.
.ls (2a)
The task must be loaded.  If it has not been loaded a message is printed
and the task query is repeated.
.le
.le
.ls (3)
\fBEparam\fR is now invoked to allow the user to set the task
parameters.
.le
.ls (4)
If \fIverify\fR = yes the command is printed and the user is asked if the
command is ok.  If ok the command is added to the script.
.le
.ls (5)
The user is asked if another command is to be added to the script.  While
the response is yes steps 2 to 5 are repeated.
.le
.ls (6)
If \fIverify\fR = yes the script is paged and the user is asked if the
script is ok.  If not ok the script is deleted, with user confirmation,
and steps 2 to 6 are repeated.
.le
.ls (7)
If the submit parameter is not specified on the command line the user
is asked if the script should be submitted as a background job.
.le

The parameter \fIhidden\fR is important for the following reason.  If
the hidden parameters are not explicitly included in the script commands
then the values of the hidden parameters will be those in the parameter
file at the time of execution.  Thus, in changes in the hidden parameters
with \fBeparam\fR or explicit changes may produce unexpected results.
However, if the hidden parameters are never changed then the commands
are more readable when the hidden parameters are not included.
.ih
EXAMPLES
One of the most common usages in data reductions is to create repeated
commands with different input data or parameters.

.nf
cl> mkscript script.cl transform

[\fIeparam\fR is called to set the parameter values for \fItransform\fR]

transform ("n1r.008", "n1r.008a", "disp012,distort,disp013",
database="identify.db", interptype="spline3", x1=1., x2=256., dx=1.,
nx=256., xlog=no, y1=4300., y2=6300., dy=INDEF, ny=800., ylog=no,
flux=yes, logfiles="STDOUT,logfile")

Is the command ok? (yes):
Add another command? (yes):

[\fIeparam\fR is called again for task \fItransform\fR]

transform ("n1r.010", "n1r.010a", "disp013,distort",
database="identify.db", interptype="spline3", x1=1., x2=256., dx=1.,
nx=256., xlog=no, y1=4300., y2=6300., dy=INDEF, ny=800., ylog=no,
flux=yes, logfiles="STDOUT,logfile")

Is the command ok? (yes):
Add another command? (yes): no

[The script is paged]

Is the script ok? (yes):
Submit the script as a background job? (yes):
Script script.cl submitted at:
Fri 10:32:57 01-Nov-85
[1]
.fi

To combine several tasks:

.nf
cl> mkscript script.cl ver- sub- hid-
Task name of command to be added to script: response

[\fIeparam\fR is called for \fIresponse\fR and parameter values are set]

Add another command? (yes):
Task name of command to be added to script: imarith
...
Add another command? (yes): no
.fi

To run the command script as a foreground job:

cl> cl < script.cl

To run the command script as a background job:

cl> cl < script.cl >& logfile &

Note that the output including possible error output is redirected to a logfile.
.ih
BUGS
The current implementation is preliminary.  It is done with a script which
makes it seem somewhat slow.  The most important bug is that the command
formatter is based on the output of \fBlparam\fR.  If a task parameter
name exceeds 12 characters it is truncated by \fBlparam\fR and is then
also truncated by the command formatter.  The script will then fail when
executed!  Also the task name may not be abbreviated.
.ih
SEE ALSO
eparam
.endhelp