Midrange News for the IBM i Community


Posted by: Danny Hayes
Record origin determination on Joined LF
has no ratings.
Published: 08 Nov 2012
Revised: 23 Jan 2013 - 1765 days ago
Last viewed on: 22 Nov 2017 (2884 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Record origin determination on Joined LF Published by: Danny Hayes on 08 Nov 2012 view comments(5)

We have a joined file that has current transaction records and history records in it.  When I am processing that file is there any way to determine which file the record is in?  I need to process differently based on origin.

I checked the INFDS, but can find nothing there.

I figured if there was a way, someone here would know! Undecided

 Thanks in advance!

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: DannyFromOP
Premium member *
Comment on: Record origin determination on Joined LF
Posted: 5 years 15 days 40 minutes ago

Both files have the same format.

A          R VEHPHY                    PFILE(PFVEHICLE PFHISTORY)
A          K SBUYER                                             

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Record origin determination on Joined LF
Posted: 5 years 14 days 23 hours 3 minutes ago

That's a UNION.

Normally the INFDS (assuming you are using the READ opcode to read the records) will reflect the file name. I know when you do an OVRDBF xxx TOMBR(*ALL) it shows you the current member name. Perhaps the member name is the only thing updated--maybe look at that instead of the file name.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Record origin determination on Joined LF
Posted: 5 years 14 days 6 hours 27 minutes ago

Are you stuck with this LF? You might need to create a multi-format LF:

     A          R VEHPHY                    PFILE(PFVEHICLE)
     A          K SBUYER
     A          R HSTPHY                    PFILE(PFHISTORY)
     A          K SBUYER

With a multi-format LF, you can use the INFDS to get the format name you just read (in my example, 'VEHPHY' vs. 'HSTPHY'). Once you know the format name, you know which PFILE.

Posted by: DannyFromOP
Premium member *
Comment on: Record origin determination on Joined LF
Posted: 5 years 14 days 11 minutes ago
Edited: Fri, 09 Nov, 2012 at 14:20:22 (1840 days ago)

Thanks for your replies, I had to lose the join file and just process one time with each physical.

Now they want to sort all blanks to the end, I told them they would have the records in reverse order.  Have I remembered incorrectly?  Is there a way to accomplish this in some other manner?

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Record origin determination on Joined LF
Posted: 5 years 13 days 16 hours 15 minutes ago

Yes you are. Creat another logical that has select/omit to include only blank records and process it last (3rd iteration).