I use this feature a lot. It's great for writing from a work file to the
production file and things like that. I also like use it when purging data
to a history file.
Here's a quick example of a purge program.
dou (%eof(myFile));
reade (inCompany:inVendor:inStatus) myFile current;
if (%eof(myFile));
iter;
endif;
reset history;
// monitor for errors - don't want day end to blow up
monitor;
eval-corr history = current;
history.adate = %date();
history.atime = %time();
history.auser = syuser;
write myRec history;
delete myRecCurrent;
on-error;
// do nothing for now, just leave the errored record in the current
file
endmon;
enddo;
*inlr = *on;
return;
James R. Perkins
"Jon Paris" <Jon.Paris@xxxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
25.09.2007 06:46
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
To
<rpg400-l@xxxxxxxxxxxx>
cc
Subject
RE: READ with DS as result
I now have MyDS.CLT_Name = "Smith" but CLT_Name is no longer filled.
Why
is this?
Two different fields in different spots in memory. The original fields
will
only get populated if you do it yourself.
If you are on V5R4, then EVAL-CORR is a nice way of handling this _but_
both
sets of fields have to be in DS. So if you are trying to populate a
display
file for example you might have a DS defined as LIKEREC the subfile record
and do an EVAL-CORR from chainDS to displayDS.
The ability to go straight to the DS _without_ touching the original
fields
is a great feature as you can - for example - read the next record without
disturbing the original data. It is also usually faster to read this way
and it can make a difference in a batch program or a subfile fill read
loop.
Jon Paris
Partner400
www.Partner400.com
As an Amazon Associate we earn from qualifying purchases.