Sequenced Records

5 pts.
Tags:
AS/400
AS/400 Records
AS/400 tables
In one of our tables there is a sub-table that keeps records based on sequence numbers. These numbers vary from record to record. Is there any logic statements within as400 queries that will tell it to just pick the most recent and Active sub-record for each record? Any help you can give would be great!

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

Let’s see if I understand what you have and what you want.

Your table has :
<pre>
KEYA KEYB STATUS
0001 00001 A
0001 00002 A
0001 00003 I
0001 00004 I
0002 00001 A
0002 00002 A</pre>
and so on…

If yo want to get for example the last active sub record of KEYA 0001 you can :
<pre>

C KEYA SETGT FILE
C READPE FILE
C DoW Not %Eof()
C If Status = ‘A’
C Leave
C EndIf
C*
C READPE FILE
C EndDo</pre>

Regards
Wilson

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following