5 pts.
Q:
Sequenced Records
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!
ASKED: May 22 2009  7:56 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2110 pts.
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • Bookmark and Share
Hi,

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

Your table has :

KEYA KEYB STATUS
0001 00001 A
0001 00002 A
0001 00003 I
0001 00004 I
0002 00001 A
0002 00002 A

and so on...

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


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


Regards
Wilson
Last Answered: May 22 2009  9:41 PM GMT by WilsonAlano   2110 pts.
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _