      PROGRAM APRFLT1T                                                          
C                                                                               
C     THIS PROGRAM TESTS APRFLT10                                               
C     WRITING IS TO LOGICAL UNIT 7                                              
C                                                                               
      REAL*4       SPEC(100),ZSPEC(100),AMP(100),PHASE(100)                     
      REAL*4       F1,F2                                                        
      INTEGER*4    NP,IP                                                        
C                                                                               
      DATA SPEC   /100*0.0/                                                     
      DATA ZSPEC  /100*0.0/                                                     
      DATA AMP    /100*0.0/                                                     
      DATA PHASE  /100*0.0/                                                     
C                                                                               
$INCLUDE SPLANE10.CMN(NLIST)                                                    
$INCLUDE ZPLANE10.CMN(NLIST)                                                    
C                                                                               
C     INITIALISE -UER- PACKAGE AND SOME LOCAL VARIABLES                         
C     *************************************************                         
C                                                                               
      CALL UERSET('APRFLT1T','W','E','N')                                       
      CALL UERLU(7)                                                             
      NP=20                                                                     
      F1=1.0                                                                    
      F2=2.0                                                                    
C                                                                               
C                                                                               
C     TEST(1):CALL APRFLT WITH TYPE OF ARRAY NOT S OR Z                         
C     *************************************************                         
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,1000)                                                             
C                                                                               
C     Initialise header of SPEC                                                 
      SPEC(PSL)=100                                                             
      SPEC(PSU)=4                                                               
      SPEC(PSX)=50   ;UNKNOWN ARRAY TYPE                                        
      SPEC(PSN)=1                                                               
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',1,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
C                                                                               
C     TEST(2):CALL APRFLT WITH NO. OF POINTS (NP) < 0                           
C     ***********************************************                           
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,2000)                                                             
C                                                                               
C     Correct SPEC(PSX)                                                         
      SPEC(PSX)=PSV                                                             
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,-1,F1,F2)                                      
      CALL UERREP('TESTFILT',2,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
C                                                                               
C     TEST(3):CALL APRFLT WITH F1 GREATER THAN F2                               
C     *******************************************                               
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,3000)                                                             
      F1=1.0                                                                    
      F2=1.0                                                                    
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',3,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
C                                                                               
C     TEST(4):CALL APRFLT WITH UNKNOWN SINGULARITY TYPE                         
C     *************************************************                         
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,4000)                                                             
C                                                                               
      F1=1.0                                                                    
      F2=2.0                                                                    
C                                                                               
C     Use the array a sit stands - i.e. correct header                          
C     the rest of the array zeroed - should give incorrect type                 
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',4,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
C                                                                               
C     TEST(5):CALL APRFLT WITH UNKNOWN SING TYPE -Z-                            
C     **********************************************                            
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,5000)                                                             
C                                                                               
C     Set up header of ZSPEC leave the rest as zeros                            
C     This will give incorrect singularity type.                                
C                                                                               
      ZSPEC(PZL)=100                                                            
      ZSPEC(PZU)=5                                                              
      ZSPEC(PZX)=PZV                                                            
      ZSPEC(PZN)=1                                                              
C                                                                               
      CALL APRFLT(ZSPEC,AMP,PHASE,NP,F1,F2)                                     
      CALL UERREP('TESTFILT',5,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
C                                                                               
C     TEST(6):CALL APRFLT WITH NUMBER OF SINGULARITIES < 0 ;SPEC(PSN)=-1        
C     ******************************************************************        
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,6000)                                                             
C                                                                               
C     Just change SPEC(PSN) - this error should be declared first.              
C                                                                               
      SPEC(PSN)=-1                                                              
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',6,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
C                                                                               
C     TEST(7):CALL APRFLT WITH NUMBER OF SINGULARITIES<0;ZSPEC(PZN)=-1          
C     ****************************************************************          
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,7000)                                                             
C                                                                               
C     Just change ZSPEC(PZN) - this error should be declared first              
C                                                                               
      ZSPEC(PZN)=-1                                                             
C                                                                               
      CALL APRFLT(ZSPEC,AMP,PHASE,NP,F1,F2)                                     
      CALL UERREP('TESTFILT',7,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
C                                                                               
C     TEST(8):CALL APRFLT WITH ONE SINGULARITY AT A TIME                        
C     **************************************************                        
C                                                                               
C     Set up header.                                                            
C                                                                               
      F1=0.0                                                                    
      F2=2.0                                                                    
      SPEC(PSL)=100                                                             
      SPEC(PSU)=6                                                               
      SPEC(PSX)=PSV                                                             
      SPEC(PSN)=1                                                               
C                                                                               
C     8.1 Call with Real Zero.                                                  
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,8100)                                                             
C                                                                               
      IP=PSH+1                                                                  
      SPEC(IP+PSM)=1                                                            
      SPEC(IP+PST)=PSTRZ                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=0.0   ;POSITION = 1.0+j0.0                                   
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     8.2 Call with Real Pole.                                                  
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,8200)                                                             
C                                                                               
      IP=PSH+1                                                                  
      SPEC(IP+PSM)=1                                                            
      SPEC(IP+PST)=PSTRP                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=0.0   ;POSITION = 1.0+j0.0                                   
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     8.3 Call with Complex Zero.                                               
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,8300)                                                             
C                                                                               
      IP=PSH+1                                                                  
      SPEC(IP+PSM)=1                                                            
      SPEC(IP+PST)=PSTCZ                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=1.0   ;POSITION = 1.0+j1.0                                   
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     8.4 Call with Complex Pole.                                               
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,8400)                                                             
C                                                                               
      IP=PSH+1                                                                  
      SPEC(IP+PSM)=1                                                            
      SPEC(IP+PST)=PSTCP                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=1.0   ;POSITION = 1.0+j1.0                                   
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     8.5 Call with Complex Conjugate Zero pair.                                
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,8500)                                                             
C                                                                               
      IP=PSH+1                                                                  
      SPEC(IP+PSM)=1                                                            
      SPEC(IP+PST)=PST2Z                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=1.0   ;POSITION = 1.0+j1.0   &  1.0-j1.0                     
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     8.6 Call with Complex Conjugate Pole pair.                                
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,8600)                                                             
C                                                                               
      IP=PSH+1                                                                  
      SPEC(IP+PSM)=1                                                            
      SPEC(IP+PST)=PST2P                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=1.0   ;POSITION = 1.0+j1.0   &  1.0-j1.0                     
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C                                                                               
C     8.7 Call with all the previous singularities.                             
C                                                                               
C     First reset header.                                                       
C                                                                               
      SPEC(PSL)=100                                                             
      SPEC(PSU)=40                                                              
      SPEC(PSX)=PSV                                                             
      SPEC(PSN)=6                                                               
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,8700)                                                             
C                                                                               
      IP=PSH+1                                                                  
      SPEC(IP+PSM)=1                                                            
      SPEC(IP+PST)=PSTRZ                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=0.0   ;POSITION = 1.0+j0.0                                   
      IP=PSH+1+PSE*1                                                            
      SPEC(IP+PSM)=2                                                            
      SPEC(IP+PST)=PSTRP                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=0.0   ;POSITION = 1.0+j0.0                                   
      IP=PSH+1+PSE*2                                                            
      SPEC(IP+PSM)=3                                                            
      SPEC(IP+PST)=PSTCZ                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=1.0   ;POSITION = 1.0+j1.0                                   
      IP=PSH+1+PSE*3                                                            
      SPEC(IP+PSM)=4                                                            
      SPEC(IP+PST)=PSTCP                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=1.0   ;POSITION = 1.0+j1.0                                   
      IP=PSH+1+PSE*4                                                            
      SPEC(IP+PSM)=5                                                            
      SPEC(IP+PST)=PST2Z                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=1.0   ;POSITION = 1.0+j1.0   &  1.0-j1.0                     
      IP=PSH+1+PSE*5                                                            
      SPEC(IP+PSM)=6                                                            
      SPEC(IP+PST)=PST2P                                                        
      SPEC(IP+PSG)=3.0                                                          
      SPEC(IP+PSJ)=4.0   ;GAIN   =  3.0+j4.0                                    
      SPEC(IP+PSR)=1.0                                                          
      SPEC(IP+PSI)=1.0   ;POSITION = 1.0+j1.0   &  1.0-j1.0                     
C                                                                               
C     Check correctly set up - call LSTFLT                                      
C                                                                               
      CALL LSTFLT(7,SPEC,'ALL SINGULARITIES')                                   
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
C     Now call APRFLT.                                                          
C                                                                               
      CALL APRFLT(SPEC,AMP,PHASE,NP,F1,F2)                                      
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C                                                                               
C     TEST(9):CALL APRFLT WITH ONE SINGULARITY AT A TIME -(Z)-                  
C     ********************************************************                  
C                                                                               
C     Set up header.                                                            
C                                                                               
      F1=1.0                                                                    
      F2=2.0                                                                    
      ZSPEC(PZL)=100                                                            
      ZSPEC(PZU)=6                                                              
      ZSPEC(PZX)=PZV                                                            
      ZSPEC(PZN)=1                                                              
C                                                                               
C     9.1 Call with Real Zero.                                                  
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,9100)                                                             
C                                                                               
      IP=PZH+1                                                                  
      ZSPEC(IP+PZM)=1                                                           
      ZSPEC(IP+PZT)=PZTRZ                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=0.0   ;POSITION = 1.0+j0.0                                  
C                                                                               
      CALL APRFLT(ZSPEC,AMP,PHASE,NP,F1,F2)                                     
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     9.2 Call with Real Pole.                                                  
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,9200)                                                             
C                                                                               
      IP=PZH+1                                                                  
      ZSPEC(IP+PZM)=1                                                           
      ZSPEC(IP+PZT)=PZTRP                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=0.0   ;POSITION = 1.0+j0.0                                  
C                                                                               
      CALL APRFLT(ZSPEC,AMP,PHASE,NP,F1,F2)                                     
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     9.3 Call with Complex Zero.                                               
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,9300)                                                             
C                                                                               
      IP=PZH+1                                                                  
      ZSPEC(IP+PZM)=1                                                           
      ZSPEC(IP+PZT)=PZTCZ                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=1.0   ;POSITION = 1.0+j1.0                                  
C                                                                               
      CALL APRFLT(ZSPEC,AMP,PHASE,NP,F1,F2)                                     
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     9.4 Call with Complex Pole.                                               
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,9400)                                                             
C                                                                               
      IP=PZH+1                                                                  
      ZSPEC(IP+PZM)=1                                                           
      ZSPEC(IP+PZT)=PZTCP                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=1.0   ;POSITION = 1.0+j1.0                                  
C                                                                               
      CALL APRFLT(ZSPEC,AMP,PHASE,NP,F1,F2)                                     
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     9.5 Call with Complex Conjugate Zero pair.                                
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,9500)                                                             
C                                                                               
      IP=PZH+1                                                                  
      ZSPEC(IP+PZM)=1                                                           
      ZSPEC(IP+PZT)=PZT2Z                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=1.0   ;POSITION = 1.0+j1.0   &  1.0-j1.0                    
C                                                                               
      CALL APRFLT(ZSPEC,AMP,PHASE,NP,F1,F2)                                     
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     9.6 Call with Complex Conjugate Pole pair.                                
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,9600)                                                             
C                                                                               
      IP=PZH+1                                                                  
      ZSPEC(IP+PZM)=1                                                           
      ZSPEC(IP+PZT)=PZT2P                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=1.0   ;POSITION = 1.0+j1.0   &  1.0-j1.0                    
C                                                                               
      CALL APRFLT(ZSPEC,AMP,PHASE,NP,F1,F2)                                     
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C                                                                               
C     9.7 Call with all the previous singularities.                             
C                                                                               
C     First reset header.                                                       
C                                                                               
      ZSPEC(PZL)=100                                                            
      ZSPEC(PZU)=40                                                             
      ZSPEC(PZX)=PZV                                                            
      ZSPEC(PZN)=6                                                              
C                                                                               
      WRITE(7,100)                                                              
      WRITE(7,9700)                                                             
C                                                                               
      IP=PZH+1                                                                  
      ZSPEC(IP+PZM)=1                                                           
      ZSPEC(IP+PZT)=PZTRZ                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=0.0   ;POSITION = 1.0+j0.0                                  
      IP=PZH+1+PSE*1                                                            
      ZSPEC(IP+PZM)=2                                                           
      ZSPEC(IP+PZT)=PZTRP                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=0.0   ;POSITION = 1.0+j0.0                                  
      IP=PZH+1+PZE*2                                                            
      ZSPEC(IP+PZM)=3                                                           
      ZSPEC(IP+PZT)=PZTCZ                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=1.0   ;POSITION = 1.0+j1.0                                  
      IP=PZH+1+PZE*3                                                            
      ZSPEC(IP+PZM)=4                                                           
      ZSPEC(IP+PZT)=PZTCP                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=1.0   ;POSITION = 1.0+j1.0                                  
      IP=PZH+1+PZE*4                                                            
      ZSPEC(IP+PZM)=5                                                           
      ZSPEC(IP+PZT)=PZT2Z                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=1.0   ;POSITION = 1.0+j1.0   &  1.0-j1.0                    
      IP=PZH+1+PZE*5                                                            
      ZSPEC(IP+PZM)=6                                                           
      ZSPEC(IP+PZT)=PZT2P                                                       
      ZSPEC(IP+PZG)=3.0                                                         
      ZSPEC(IP+PZJ)=4.0   ;GAIN   =  3.0+j4.0                                   
      ZSPEC(IP+PZR)=1.0                                                         
      ZSPEC(IP+PZI)=1.0   ;POSITION = 1.0+j1.0   &  1.0-j1.0                    
C                                                                               
C     Check correctly set up - call LSTFLT                                      
C                                                                               
      CALL LSTFLT(7,ZSPEC,'ALL SINGULARITIES')                                  
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
C     Now call APRFLT.                                                          
C                                                                               
      CALL APRFLT(ZSPEC,AMP,PHASE,NP,F1,F2)                                     
      CALL UERREP('TESTFILT',8,.FALSE.)                                         
      CALL UERCLR                                                               
C                                                                               
      CALL OTPUT(NP,AMP,PHASE)                                                  
C                                                                               
C     FORMAT STATEMENTS                                                         
C     *****************                                                         
C                                                                               
100   FORMAT(X,//)                                                              
1000  FORMAT(X,'TEST(1):CALL APRFLT WITH ARRAY TYPE NOT S OR Z')                
2000  FORMAT(X,'TEST(2):CALL APRFLT WITH NP<0')                                 
3000  FORMAT(X,'TEST(3):CALL APRFLT WITH F1>F2')                                
4000  FORMAT(X,'TEST(4):CALL APRFLT - UNKNOWN SING TYPE')                       
5000  FORMAT(X,'TEST(5):CALL APRFLT - UNKNOWN SING TYPE (Z)')                   
6000  FORMAT(X,'TEST(6):CALL APRFLT - NO OF SINGS < 0')                         
7000  FORMAT(X,'TEST(7):CALL APRFLT - NO OF SINGS < 0 (Z)')                     
8100  FORMAT(X,'TEST(8.1):CALL APRFLT - REAL ZERO (S)')                         
8200  FORMAT(X,'TEST(8.2):CALL APRFLT - REAL POLE (S)')                         
8300  FORMAT(X,'TEST(8.3):CALL APRFLT - COMPLEX ZERO (S)')                      
8400  FORMAT(X,'TEST(8.4):CALL APRFLT - COMPLEX POLE (S)')                      
8500  FORMAT(X,'TEST(8.5):CALL APRFLT - CONJUGATE ZERO (S)')                    
8600  FORMAT(X,'TEST(8.6):CALL APRFLT - CONJUGATE POLE (S)')                    
8700  FORMAT(X,'TEST(8.7):CALL APRFLT - ALL SINGULARITIES (S)')                 
9100  FORMAT(X,'TEST(9.1):CALL APRFLT - REAL ZERO (Z)')                         
9200  FORMAT(X,'TEST(9.2):CALL APRFLT - REAL POLE (Z)')                         
9300  FORMAT(X,'TEST(9.3):CALL APRFLT - COMPLEX ZERO (Z)')                      
9400  FORMAT(X,'TEST(9.4):CALL APRFLT - COMPLEX POLE (Z)')                      
9500  FORMAT(X,'TEST(9.5):CALL APRFLT - CONJUGATE ZERO (Z)')                    
9600  FORMAT(X,'TEST(9.6):CALL APRFLT - CONJUGATE POLE (Z)')                    
9700  FORMAT(X,'TEST(9.7):CALL APRFLT - ALL SINGULARITIES (Z)')                 
C                                                                               
      STOP                                                                      
      END                                                                       
C                                                                               
C                                                                               
      SUBROUTINE OTPUT(I,AMP,PHASE)                                             
C                                                                               
      INTEGER*4   I                                                             
      REAL*4      AMP(I),PHASE(I)                                               
C                                                                               
      WRITE(7,11)                                                               
      WRITE(7,10)                                                               
      DO 12 J=1,I                                                               
      WRITE(7,13)J,AMP(J),PHASE(J)                                              
12    CONTINUE                                                                  
C                                                                               
10    FORMAT(X,16X,'MAGNITUDE',9X,'PHASE(DEG)',/)                               
11    FORMAT(X,/)                                                               
13    FORMAT(X,5X,I3,4X,F14.7,4X,F14.7)                                         
C                                                                               
      RETURN                                                                    
      END                                                                       
