
/*      TESTING OF THE function remove        
        FOR FILEs.  
*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#define N 8
#define NL 1000
static void remove1101();

static void ansyes(char tname[]);
static void ansno(char tname[]);

int main(int argc, char *argv[])
{
   printf("===START REMOVE11========================\n");
      remove1101();

      printf("=== END OF TREMOVE11 ========================= \n");
      return 0;
}
/* -------------------------------------------------remove1101  */
      void remove1101()
{


      char tname[]="REMOVE_1101";
      int i,nloopi,ni,nb,na;
      FILE *fp;
                
      #pragma dvm array distribute[block]          
      int A[N];
      #pragma dvm array align ([i] with A[i])
      int B[N];



      nloopi=NL;

      #pragma dvm region out(A,B) 
      {
    #pragma dvm parallel ([i] on A[i])
      for (i=0;i<=N-1;i++)
        {  A[i] = NL+i;
           B[i]=777;
        }
      } /*end region*/  

      #pragma dvm get_actual(A,B) 

     if((fp=fopen("ARREMOVE_1101", "wl"))==NULL) {
     printf("ERROR OPENING FILE ARREMOVE_1101 \n");
     exit(1);
     }
        for (i=0;i<=N-1;i++) {
       #pragma dvm remote_access(A[i])
        {  
         na=A[i];
        }   
        ni=fprintf(fp, "%d ", na);  
        }
     fclose(fp);
     if (remove("ARREMOVE_1101"))
        ansno(tname);
    else
        ansyes(tname);

      return ;

   
}
      


void ansyes(char name[])
{
      printf ("%s  -  complete\n",name);
    return ;
}
      void ansno(char name[])
{
     printf("%s  -  ***error\n",name);
      return ;
}
