50 pts.
 Merge two Physical Files using Logical File
I have multiple Physical files (Trans2006, Trans2007, Trans2008, etc…) with same record layout with the yearly transactions on my iSeries. I want to merge these files (for temporary period). Is it possible to create a Logical file? If so please help me.

Software/Hardware used:
ASKED: March 12, 2009  10:41 PM
UPDATED: January 12, 2012  12:32 AM

Answer Wiki:
Yes, that would be what a database system *does* in life. You could create a simple Access Path as a Logical file - see <i>DB2 Universal Database for iSeries Database Programming </i> contains information about the DB2 Universal Database for iSeries (DB2 UDB for iSeries) database management system, and describes how to set up and use a database on IBM ERserver iSeries 400 using traditional system interfaces. and <i>Programming DDS for physical and logical files</i> both of these, and much, much more can be found at <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp"> you could also consider copying the two files into a single physical with the CPYF command. use it, then delete it. ////////////////////////////////////////////// Your logical would look something like this A* File1 A R FILE1R PFILE(FILE1) A K FLD1 A K FLD2 A K FLD3 A* File2 A R FILE2R PFILE(FILE1) A K F2D1 A K F2D2 A K F2D3 Where FILE1R and FILE2R are the record names of the physical files Fields FLD1-3 are key fields from file1 and F2D1-3 are the corresponding key fields from file2. You may want to create a differnt record format for one so you can use the RENAME keyword to rename fields so they have the same field names. Phil
Last Wiki Answer Submitted:  March 13, 2009  1:16 pm  by  Yorkshireman   5,505 pts.
All Answer Wiki Contributors:  Yorkshireman   5,505 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

 

thanks phil. I created a logical.

 50 pts.

 

Create a “Union” logical file by using the exact same syntax as you would creating a standard logical file but on the PFILE statement, enter BOTH of the file names. You can also qualify the file names on the PFILE statement so that the files do not have to reside in the same library. If your logical has a key though, remember that you will get “dinged” if you have a record in each file with the same key.

Example: PFILE(LIB1/FILE1 LIB2/FILE1)
or if the files are not the same name but in the same library, you can use…..
PFILE(FILE1 FILE2)

You are also not limited to just 2 files. I don’t know the limit off the top of my head, but it’s definitely more than 2.

 10 pts.

 

“dinged”? Sounds exciting, what happpens?

 44,190 pts.