function report( B_ok_r_ff,no_B,no_r,B_ff_r_ok,B_ff_r_ff,myfilelist,...
		 lauf,advanced,mode,nolog,outputspath,varname)
%**************************************************************************
% CLUSTER project: Execution reports               Autor: Christian Maszl 
% Unit System = [SI]                  Mail: e0025754@student.tuwien.ac.at 
%**************************************************************************
%
% Version 1.0 - 20.8.2004
%
% This subroutine stores the errors during the execution of yuri.m
% in the output directory (*.report) . Check this file always
% before you start to work with the data! It might happen that
% there exists B field data and no position etc.

% Create logfiles YES='y' / NO='n'
if (nolog=='y')
% Get date from the filename
datum=myfilelist{lauf,1};
datum=datum(1,1:6);
% Create date string. Example: 25-Jan-2002
year =str2num(datum(1,1:2));
month=str2num(datum(1,3:4));
day  =str2num(datum(1,5:6));
datum=datestr(datenum([2000+year month day]));
%**************************************************************************
% Find time intervals (computation is splited)
%**************************************************************************
t_interval=advanced(1,4);
% Store hours in sec    (0=default)
zeit(1,1) =advanced(1,1)*3600;
% Store minutes in sec  (0=default)
zeit(1,2) =advanced(1,2)*60;;
% Store seconds (1sec after midnight=default)
zeit(1,3) =advanced(1,3);
% Data is splited into four 6 hour parts.
t_interval=t_interval/4;
% Find starttime in seconds
starttime(1,1)=zeit(1,1);
starttime(1,2)=starttime(1,1)+t_interval+1;
starttime(1,3)=starttime(1,2)+t_interval+1;
starttime(1,4)=starttime(1,3)+t_interval+1;
starttime(1,5)=starttime(1,4)+t_interval-3;
% Convert into hm time format
starttime=sec2hm(starttime);
% Extract hours and minutes
for i=1:1:5
t=num2str(starttime(1,i));
l=size(t,2);
    if (l<=2)
        hour(i)  =0;
        minute(i)=str2num(t);
    else
        hour(i)  =str2num(t(1,1:l-2));
        minute(i)=str2num(t(1,l-1:l));
    end
end
%************************************************************************************
% Check for no data in intervals
%************************************************************************************
linefeed=1;
for i=1:1:4
    if (no_B(i)==1)
    % Dispay message for the whole day if true
message=[datum  ' ' int2str(hour(1)) ':' int2str(minute(1)) '->' ...
	 int2str(hour(5)) ':' int2str(minute(5))  ', Mode: ' ...
	 mode ', MISSING data ' varname int2str(i) ' for SC' int2str(i)...
	 ' for the whole day!'];
         error_report(linefeed,1:size(message,2))=message;
             linefeed=linefeed+1;
    else
    for j=1:1:4
        % Make sure that r and B are not both missing
        if (B_ff_r_ff(i,j)==0)
	    % Check for each time interval
            if (B_ff_r_ok(i,j)==1)
	    message=[datum ' ' int2str(hour(j)) ':' int2str(minute(j)) ...
                     '->' int2str(hour(j+1)) ':' int2str(minute(j+1))  ...
                     ', Mode: ' mode ', ATTENTION: No ' varname ...
                     ' data for SC' int2str(i) ...
		     ' in this time interval!  Position data r existent!'];
            error_report(linefeed,1:size(message,2))=message;
                         linefeed=linefeed+1;
	    else
	    end
	else
	  
	end
	
    end  
    end
    % Display message for the whole day if true
    if (no_r(i)==1)
message=[datum  ' ' int2str(hour(1)) ':' int2str(minute(1)) '->' ...
	 int2str(hour(5)) ':' int2str(minute(5))  ', Mode: ' ...
	 mode ', MISSING position data r' int2str(i) ' for SC' ...
	 int2str(i) ' for the whole day!'];
         error_report(linefeed,1:size(message,2))=message;
             linefeed=linefeed+1;
    else
    for j=1:1:4
        % Make sure that r and B are not both missing
        if (B_ff_r_ff(i,j)==0)
	    % Check for each time interval
            if (B_ok_r_ff(i,j)==1)
	    message=[datum ' ' int2str(hour(j)) ':' int2str(minute(j)) '->' ...
		     int2str(hour(j+1)) ':' int2str(minute(j+1))  ', Mode: '...
		     mode ', ATTENTION: No position data for SC' int2str(i) ...
		     ' in this time interval! ' varname ' data existent!'];
            error_report(linefeed,1:size(message,2))=message;
                         linefeed=linefeed+1;
	    else
	    end
	else
        end  
    end
    end
end
% Take a name of the datapackage and replace the satellite number with
% .report 
    satz    =strrep(myfilelist{lauf,1},'.01','.report');
    filename=[outputspath satz];
% Save error_report to HD
    save(filename,'error_report','-mat'); 
else
end
