mdsconnect('tcvdata');
while ~strcmpi(deblank(mdsvalue( ...
	'vdbget( "tcv_protectdb::shot_create:command_1")')),'EXIT'),
  while ~strcmpi(deblank(mdsvalue( ...
		'vdbget("tcv_protectdb::cycle:shot_create")')),'ON'),
    fprintf('.')
    pause(3)
  end
  rec_arg=deblank(mdsvalue( ...
	'vdbget("tcv_protectdb::shot_create:command_1")'));
  fprintf(['\nExecuting recipe ',rec_arg,'\n'])
  mdsvalue('vdbput("operatordb::cycle:shot_create","OFF")');
  if ~strcmpi(rec_arg,'EXIT'),
% parse
    icom=strfind(rec_arg,',');
    if ~isempty(icom),
      main_arg=lower(rec_arg(1:icom(1)-1));
      supp_arg=strrep(lower(rec_arg(icom(1):end)),'"','''');
    else
      main_arg=lower(rec_arg);
      supp_arg=[];
    end
    eval(['tcv_recipe(''',main_arg,'''',supp_arg,');'])
  end
end
mdsvalue('vdbput("tcv_protectdb::shot_design:pending","off")');
mdsvalue('vdbput("tcv_protectdb::shot_create:command_1","")');
exit
