Merge two Physical Files using Logical File

50 pts.
Tags:
Data Description Specifications
DDS
Logical Files
Physical 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.

Answer Wiki

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

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

Discuss This Question: 4  Replies

 
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
  • Yorkshireman
    report
  • nhewage
    thanks phil. I created a logical.
    50 pointsBadges:
    report
  • HDFatboy98
    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 pointsBadges:
    report
  • philpl1jb
    “dinged"? Sounds exciting, what happpens?
    49,940 pointsBadges:
    report

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