* diagnostics-clos.inc

DISPLAY "#### START: diagnostics-clos.inc";   

PARAMETER

  errfacclos(sim,f)                 if =UNDF facclos is missing
  err2facclos(sim,f)                if =UNDF facclos NE 1 and facclos NE 2 and facclos NE 3 and facclos NE 4  
  errflandclos(sim,f)               if =UNDF facclos for fland NE 1
  
  errnumeraire(sim)                 if =UNDF numeraire is missing
  err2numeraire(sim)                if =UNDF numeraire NE 1 and numeraire NE 2

  errgovclos(sim,t)                   if =UNDF govclos is missing
  err2govclos(sim,t)                  'if =UNDF govclos NE 1,2,3,4,5,6,7,8,9,10'
  err3govclos(sim,t)                if =UNDF govclos EQ 1 without taxdir

  errsiclos(sim)                    if =UNDF siclos is missing
  err2siclos(sim)                   if =UNDF siclos NE 1 and siclos NE 2 and siclos NE 3

  errrowclos(sim)                   if =UNDF rowclos is missing
  err2rowclos(sim)                  if =UNDF rowclos NE 1

  
  errsigovclos(sim,t)                 if =UNDF siclos EQ 4 and govclos EQ 2
  
 
  errgovrecrule(sim,acgovrec)       if =UNDF value not valid for govrecrule
  errgovrecrule2(sim,acgovrec)      if =UNDF for govrecrule for acgovrec =2 with relevant payment=0

  errgovspndrule(sim,acgovspnd)     if =UNDF value not valid for govspndrule
  errgovspndrule2(sim,acgovspnd)    if =UNDF for govspndrule for acgovspnd =2 with relevant payment=0
  
  errngovpayrule(sim,acngovpay)     if =UNDF value not valid for ngovpayrule
  errngovpayrule2(sim,acngovpay)    if =UNDF for ngovpayrule for acngovpay =2 with relevant payment=0



;

errfacclos(sim,fncap)$(NOT facclossim(sim,fncap)) = 1/0;
errfacclos(sim,fcapng)$(NOT facclossim(sim,fcapng)) = 1/0;





errnumeraire(sim)$(NOT numerairesim(sim)) = 1/0;
errgovclos(sim,t)$(NOT govclossim(sim,t)) = 1/0;
errsiclos(sim)$(NOT siclossim(sim)) = 1/0;
errrowclos(sim)$(NOT rowclossim(sim)) = 1/0;
DISPLAY errfacclos, errnumeraire, errgovclos, errsiclos, errrowclos;
 



err2numeraire(sim)$(numerairesim(sim) NE 1 AND numerairesim(sim) NE 2) = 1/0;
DISPLAY err2numeraire;

err2facclos(sim,fncap)$(facclossim(sim,fncap) NE 1 
  AND facclossim(sim,fncap) NE 2 
  AND facclossim(sim,fncap) NE 3 
  AND facclossim(sim,fncap) NE 4) = 1/0;
err2facclos(sim,fcapng)$(facclossim(sim,fcapng) NE 1 
  AND facclossim(sim,fcapng) NE 2 
  AND facclossim(sim,fcapng) NE 3 
  AND facclossim(sim,fcapng) NE 4) = 1/0;  
DISPLAY err2facclos;

errflandclos(sim,fland)$(CARD(fland) NE 0 AND facclossim(sim,fland) NE 1) = 1/0;
DISPLAY errflandclos;

err2govclos(sim,t)$(govclossim(sim,t) NE 1 
  AND govclossim(sim,t) NE 2 
  AND govclossim(sim,t) NE 3 
  AND govclossim(sim,t) NE 4 
  AND govclossim(sim,t) NE 5 
  AND govclossim(sim,t) NE 6
  AND govclossim(sim,t) NE 7
  AND govclossim(sim,t) NE 8
  AND govclossim(sim,t) NE 9
  AND govclossim(sim,t) NE 10
  AND govclossim(sim,t) NE 11
  ) = 1/0;
DISPLAY err2govclos; 

err3govclos(sim,t)$(govclossim(sim,t) EQ 1 AND NOT SUM((taxdir,insdng), SAM(taxdir,insdng))) = 1/0;
DISPLAY err3govclos;


err2rowclos(sim)$(rowclossim(sim) NE 1) = 1/0;
*err2rowclos(sim)$(rowclossim(sim) NE 1 AND rowclossim(sim) NE 2) = 1/0;
DISPLAY err2rowclos;

err2siclos(sim)$(siclossim(sim) NE 1 AND siclossim(sim) NE 2 AND siclossim(sim) NE 3 AND siclossim(sim) NE 4) = 1/0;
DISPLAY err2siclos;


errgovrecrule(sim,acgovrec)$(govrecrulesim(sim,acgovrec) NE 1 AND govrecrulesim(sim,acgovrec) NE 2) = 1/0;
DISPLAY errgovrecrule;

errgovspndrule(sim,acgovspnd)$(govspndrulesim(sim,acgovspnd) NE 1 AND govspndrulesim(sim,acgovspnd) NE 2) = 1/0;
DISPLAY errgovspndrule;

errngovpayrule(sim,acngovpay)$(NOT trrowngov(acngovpay) AND NOT trrowfac(acngovpay) AND ngovpayrulesim(sim,acngovpay) NE 1 AND ngovpayrulesim(sim,acngovpay) NE 2) = 1/0;
DISPLAY errngovpayrule;


errgovspndrule2(sim,acgovspnd)$(govspndrulesim(sim,acgovspnd)=2 AND GOVSPNDGDP00(acgovspnd)=0 AND dmod NE 2) = 1/0; 
DISPLAY errgovspndrule2;
DISPLAY "suggested solution: switch to govspndrulesim(sim,acgovspnd) = 1";

errgovrecrule2(sim,acgovrec)$(govrecrulesim(sim,acgovrec)=2 AND GOVRECGDP00(acgovrec)=0 AND dmod NE 2) = 1/0; 
DISPLAY errgovrecrule2;
DISPLAY "suggested solution: switch to govrecrulesim(sim,acgovrec) = 1";

errngovpayrule2(sim,acngovpay)$(ngovpayrulesim(sim,acngovpay)=2 AND NGOVPAYGDP00(acngovpay)=0 AND dmod NE 2) = 1/0; 
DISPLAY errngovpayrule2;
DISPLAY "suggested solution: switch to ngovpayrulesim(sim,acngovpay) = 1"; 


errsigovclos(sim,t)$(siclossim(sim) EQ 4 AND govclossim(sim,t) EQ 2) = 1/0;
DISPLAY errsigovclos;









DISPLAY "#### END: diagnostics-clos.inc";     