ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Procedures, update file and dowhile loop

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Re: Procedures, update file and dowhile loop

    ok
    doing a debug, and for my surprise:
    in some time the dowhile ended, but.. when? .......after reading the whole file twice!!
    Clearly:
    - first time procedure call, reads and updates all records on file once, obviously, ok.
    - second time procedure call, it reads and updates the whole file TWICE!! and then leaves.

    Can anyone tell me why the f**??

    Comment


    • #17
      Re: Procedures, update file and dowhile loop

      Total suggestion here but, why not do something like:

      Code:
      open detalle25; 
      setll *loval polel70a;  
      read polel70a;          
      dow not %eof(polel70a);     // <----        
       CreateData25(); 
       key12.p12cdp = p62cdp;             
       setll %kds(key12:1) prolef12;      
       reade %kds(key12:1) prolef12;
       dow not %eof(prolef12);     // <----
           Update25();                    
           CopyFile();                                
           reade %kds(key12:1) prolef12;  
       enddo;          
       close detalle25;     
       ClearFile();
       open detalle25;      
       read polel70a;   
      enddo;
      It's possible it could be having issues with the %eof function call.

      Comment

      Working...
      X