× 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.



Scott, the only thing is the Status code is not part of the key.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Tuesday, September 11, 2007 12:49 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Read question

Phil Kestenbaum wrote:
What actually happens when the status is changed? Is the program still
going to read the original records anyway? I would think not but
wanted
to check.

If I understand you correctly you're doing something like this:


setll ('A') MYLOGICAL;
READ MYLOGICAL;

dow not %EOF and status='A';
status = 'H';
UPDATE MYLOGICALRECFMT;
READ MYLOGICAL;
enddo;


Is that correct? What happens when the status is changed? Err, well,
when you run the READ op-code, the contents of the status field are
copied from the database to a field in your program's memory. When you
change the status field to an H, you change that memory to be an H.
When you run the UPDATE op-code, it moves the field from memory back to
the database file, causing the field to change in the file.

When you read the next record, it reads the next record with an 'A' that

occurs after the last one you read.

Is the program still going to read the "original records"? I don't know

what you mean by "original". Do you mean all of the records marked with

an "A"? Yes, it'll read them all, unless a program adds some additional

"A" records while you're processing it. But, that's what your code
was supposed to do, right? Read all of the records that contain an "A"?

That's why I'm confused by your question... You don't think it's
going to read them all, and I don't understand why not...?? You coded
it to read them all! Then I find myself thinking, maybe when he said
"original", he didn't mean status code A? But... the program is coded
to read in key sequence based on the A, so it shouldn't read anything
that's not status code A -- except on the last READ statement, when it
sees a non-A record, and terminates the loop...

So I guess I really don't understand what you're asking.

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.