× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Not a problem, I'm just glad someone else could find this useful. Just
keep in mind this will only work with V5R4.

Sorry about that. That should have been "delete myFileRec;". Just deleting
the record from the current file after it is written to history.

In regards to the %eof BIF, it's mainly just a personal thing. I tend to
design that way so when the next person comes along they know what file is
being tested for the end of file. I find it very frustrating when looking
at some programs that test for %eof() somewhere else in the program, or
%found(), and you have to figure out which file they are testing the
condition on.

I do realize in this case it is fairly obvious, but it's a standard way I
write code and for my self, I just try to stick with it. I do the same the
%found() BIF too.

James R. Perkins




"David Foxwell" <david.foxwell@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
26.09.2007 00:31
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
"RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
cc

Subject
Re: READ with DS as result







I'm keeping this for future use, thanks a lot.
Can you please explain the delete line ? I don't understand that bit.

A minor improvement : instead of if (%eof(myFile)); why not if %eof;
?

----- Original Message -----
From: <JRPerkins@xxxxxxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Tuesday, September 25, 2007 6:39 PM
Subject: RE: READ with DS as result


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

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.