Syntax Error on procedure call
LukeD wrote on Mar 02, 2017
I am trying to create my first procedure script by creating a .cl script, placing it in /home/iraf/listcreate.cl and then running
task listcreate = /home/iraf/listcreate.cl
but whenever I try to run it by typing 'listcreate' I get an error:
**: procedure listcreate (output)
^
ERROR: syntax error
This is listcreate.cl;
procedure listcreate (output)
string output {prompt="Output List prefix"}
begin
files *.fits > output//"list_master"
end
Can anyone help me find out whats wrong?
Also if anyone could help me with the syntax for making the output list prefix a user defined variable, that'd be great!!
Thanks,
Luke
Mike Fitzpatrick wrote on Mar 08, 2017
I don't understand the specific error message since there isn't a syntax error on the 'procedure' line, however the syntax for the 'files' command is in the wrong format. It should be:
files ("*.fits", > output//"list_master")
The difference is between the "compute mode" syntax you would use on the command line, and the "program mode" syntax used in scripts. Even so, I couldn't find a way to execute the script, change the newlines, etc that produced the same error message you got.
Also if anyone could help me with the syntax for making the output list prefix a user defined variable, that'd be great!!
I don't understand the question -- the prefix is the task parameter 'output'. If you mean an environment variable, then to set the variable you would do:
cl> set foo = "bar"
and then in the script use it as something like
print ("variable foo is " // envget ("foo"))
Last post on Mar 08, 2017