×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Do Loop Problem

Do Loop Problem

Do Loop Problem

(OP)
The first record of the SAC has PO# 12345 and Item: ABCDE.

The ex_850dtly file has 2 records with that PO and Item combination.  However, it seems to ignore the "dou not %found(ex_850dtly)" command and goes through the loop the 3rd time.  when it hits the UPDATE, it bombs out.

What am I doing wrong?

Here is the code:

/free                                                
   read ex_850sac;                                   
   dou %eof(ex_850sac);                              
     setll (edsacpo:edsacitm) ex_850dtly;            
     reade (edsacpo:edsacitm) ex_850dtly;            
     dou not %found(ex_850dtly);                     
       item = %subst(edpo107:1:6);                   
       color = %subst(edpo113:1:2);                  
       if %subst(edsacupc:2:5) = %subst(edpo107:1:5);
         size = '000';                               
       else;                                         
         size = %subst(edpo113:3:3);                 
       endif;                                        
       edpo118 = 'IS';                               
       edpo119 = item + '-' + color + '-' + size;    
       edpo120 = 'MU';                               
       edpo121 = edsacupc;                           
       update edformat;                              
       reade (edsacpo:edsacitm) ex_850dtly;          
     enddo;                                          
     read ex_850sac;                                 
   enddo;                                                 
   *inlr = *on;                                           
   return;                                                
/end-free                                                  

RE: Do Loop Problem

Use:

dow not %EOF(ex_850dtly)

The dow will prevent entering the loop in case there are records with that key in ex_850dtly.

The setll uses %found to tell you that an equal key exists. But, when you issue the reade, then you need the %eof for the do loop.
 

RE: Do Loop Problem

The difference between DOU and DOW is that DOU always esecutes a loop at least once. Therefore, hou have to check the condition at the top of the loop (but you only need one READ or READE).

A DOW loop does not execute at all if the condition isn't met, and you need two READs or READEs.
 

Nullum gratuitum prandium.
--Sleipinir214

 

RE: Do Loop Problem

Does anyone know if there are any good windows based RPG IV appliations out there?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close