Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do Loop Problem

Status
Not open for further replies.

Oche

Programmer
Sep 14, 2007
11
0
0
US
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
 
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.
 
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

 
Does anyone know if there are any good windows based RPG IV appliations out there?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top