How to correctly use PFILE keyword in DDS Logical File? (AS400) I'm having trouble wording this question right (also not sure if I'm in the right stack section)

My issue is that I have a logical file ORDFILE located in the ORDRENTLB library, that is suppose have access to the physical file data of CIFFILE located in the CUSTINFOLB library.

When compiling, all I get for the program is the error "ended abnormally".

However, when I remove PFILE(CUSTINFOLB/CIFFILE), and change the type to PF, it compiles perfectly.

The CIFFILE has compiled successfully as its only a PF.

what I have tried:
Moving ORDFILE to the same library as CIFFILE (abnormal ending error)
Tried stating CUSTOMER as a foreign key by placing an F next to CUSTOMER in ORDFILE (got an error)
Tried placing single quotes around 'CUSTINFOLB/CIFFILE', (error)

what am I doing wrong?

thanks for your time.




EDIT

Scope: To create a small distribution system on the iSeries platform.
Create a series of libraries that includes code for the following:


Customer Information File (CIF) Functionality
Order Entry Functionality
Purchasing Functionality
Inventory Functionality


My requirements: 


Create 4 DDS Specifications for each of the 4 file groups based on
the information specified.
Create 4 DFU programs for each of the 4 files you set up with DDS
specifications.
Create 4 CL programs to run the DFU programs you have created.


Include some comments as well as a message that will appear on the screen once the menu option has been chosen.  For example, if you chose Option # 1 to Enter CIF data, a message should initially appear such as - 
                     'CIF DATA ENTRY PROGRAM IS NOW EXECUTING' 


Create 3 Menus for each of the 3 departments(Order Entry/Inventory
/Purchasing) with appropriate titles on each menu.
Create a main menu called MAINMENU to access the 3 department menus.
Create a Query/400 report based on the CIF file and add it to the
main menu as an option.


Ensure that you have followed the 3 requirements as follows:

Create the Query as a report by choosing the  'Print' option.  Format the CIF # to eliminate the ‘,’ from the number on the report. Place a Page heading on the report.


The Main menu should include the following menu options:


Go to the 3 various ‘department’ menus Run the CIF Query program Access the Spool file Sign off


Set up the CLP programs on the menus you have created.


The CIF Master File must only exist in one place, but all departments must be able to access the same file.


  The Database:
  
  Customer Information File => 
  
  Customer Number (5 digit numeric field) – KEY 
  
  Company Name 
  
  Contact Name   
  
  City  
  
  Phone number   
  
  Total Customer Order amount ($) 
  
  Order Entry File =>
  
  Order Entry Number (6 digit numeric field) – KEY
  
  Customer Number
  
  Item Number Ordered (10 char.)
  
  Date Ordered Quantity Ordered
  
  Ordered By (Person's Name)
  
  Total amount of Order ($)
  
  Inventory File => 
  
  Part Number (6 digit numeric field) – KEY  
  
  Part description 
  
  Quantity on hand 
  
  Unit Cost  
  
  Out of Stock Indicator (1 byte Alpha)
  
  Purchase File =>  
  
  Purchase Order Number (4 digit numeric field) – KEY  
  
  Part number  
  
  Quantity Purchased  
  
  Quantity Back-ordered  
  
  Purchase Date 
  
  Total Purchase Order Amount ($)
Each of these four things should be given its own PF (aka table).  In the real world, any of them might even be best served by additional supplementary tables, as may be appropriate.  For example, suppose a customer wishes to pace an order for several different items.  This would normally be handled with an order header file, to store data pertaining to the order as a whole, and an order detail file for each item being ordered. But we'll stay within the bounds of your assignment, which has been specifically worded with an expected design.

The tables do not access each others information, per se. But they will contain fields (aka columns) which will refer to key field in other tables.  It is generally a good idea to create indexes on each table, for the various ways we can expect it to be accessed, by creating a simple keyed logical file for each such key sequence.

In this case, after you have defined your ORDFILE, you might define a logical file, called for example ORDFILE1, with CUSTOMER as the [first] key field, perhaps followed by ORDRNUM.  You might have another keyed by ITEMNUM. Whatever key sequences may come in handy can each have it's own LF. Indexes are very low overhead on the iSeries, so having several dozen is not a problem, even though other platforms might have a lower recommend guideline. So in the real world you might want to create a good variety over these files, to help the optimizer with various queries that your users may want.  For an assignment like this, create only those that are relevant to the requirements.

The type of LF that would combine fields from various physicals is called a join (or joined) logical file. Unless your professor has mentioned it, that may be outside the scope of his/her expectations.  A query can read multiple PFs, much as a join logical would, so a join LF may be superfluous in this case.



Disclaimer

Modern best practices on this platform would generally be to use SQL for databases, rather than DDS &amp; Query/400.  And it may be handy to know that QM Query can convert Query/400 queries to SQL.  But most companies still have plenty of DB files defined with DDS. It is important to understand these earlier technologies when you are a professional developer on this platform, since you may have to support them.