Hola Alberto,
 
Yo lo haría así:
 
Farqtdatmp UF   e           K disk    Rename(Rarqtdatmp:rOld)
F                                     Prefix('Old.')         
Farqtda    UF   e           K disk    Rename(Rarqtdatmp:rNew)
F                                     Prefix('New.')         
                                                             
d DSOld           DS                  Likerec(rOld)          
d DSNew           DS                  Likerec(rNew)          
 
/Free                        
   Setll *start Arqtdatmp;   
   Dou %Eof(Arqtdatmp);  
       Read Arqtdatmp;       
       If %Eof(arqtdatmp);   
          Leave;             
       Endif;                
       Exsr Srproces;        
Enddo;                        
                              
*inlr=*On;                    
                              
Begsr Srproces;               
Chain ( old.aqemp             
       :old.aqten             
       :old.aqanys            
       :old.aqset             
       :old.aqmes             
       :old.aqdia) Arqtda;    
If Old.Aqevento='2'; //Elimino
   If %Found(Arqtda);         
      Delete rNew;            
   Endif;                     
Else; //Afegeixo o actualitzo 
   DSNew=DSOld;               
      If Not %found(Arqtda); 
         Write rNew; 
      Else;          
         Update rNew;
      Endif;         
   Endif;            
   Delete rOld;      
   Endsr;            
/End-Free            
 
Saludos, 
Jordi.


      
____________________________________________________
Únete a Recursos AS400, nuestra Comunidad ( http://bit.ly/db68dd )
Forum.Help400 © Publicaciones Help400, S.L.

Responder a