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. CIFFILE



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


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 ($)

  • These are two different files. This does not look like either would be a logical file over the other. Please explain what sort of access of one file to the other you are trying to accomplish. Also explain what it is you are trying to accomplish, in business terms. – WarrenT May 10 '15 at 7:13
  • @WarrenT I've updated my question to include the scope of what my task is. The CIFFILE should be Physical, and the ORDFILE should be logical because it's trying to access the CIFFILE right? Because when I use PFILE keyword, it doesn't work unless I have ORDFILE type as LF. – SorryEh May 10 '15 at 14:12
  • This sounds like a homework assignment, correct? – WarrenT May 10 '15 at 15:06
  • @WarrenT It is, but I'm not looking for anyone do it for me. I just don't know what I'm doing wrong. In my lab, I had a similar exercise, both the logical and physical files were in the same source file, and it compiled without any issues (tried the same for this assign. no luck). I've gone back and forth numerous times with it and I can't see what I'm doing wrong and the error doesn't help lol. My professor is away until after the due date (which is not for at least a month, but i dont like leaving things till last minute). Is there anything you can suggest that can help me figure this out? – SorryEh May 10 '15 at 15:26

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.


Modern best practices on this platform would generally be to use SQL for databases, rather than DDS & 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.

| improve this answer | |
  • so I created the PF for ORDERENTRY with the existing LF for it as well. I can get it to compile if i only use PFILE(ORDERENTLB/ORDFILE), but if i try to get the PFILE(CUSTINFOLB/CIFFILE1) (LF) to join the ORDFILE1 LF it doesnt work. I also tried CIFFILE which is the PF still no luck. I also tried including both PFILE ORDFILE and PFILE CIFFILE1. Am i suppose to use the PFILE/CIFFILE1 or keep it with just the ORDFILE and have a column for CUSTOMER ? – SorryEh May 10 '15 at 17:27
  • The PFILE () keyword is looking for the name of the physical file that the logical file will be looking at. A join logical will be built over two (or more) physicals. – WarrenT May 11 '15 at 11:24
  • amazing, thank you so much, I used the publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/dds/… to learn how to use join properly and its compiling now. Thanks you very much Warren! i can finally continue with the rest. – SorryEh May 11 '15 at 13:52
  • Your system should be much more current than that old documentation. Check the heading of a compiled listing to find your OS release of IBM i. You should be on 6.1 (v6r1), 7.1, or 7.2. Then go to the IBM Knowledge Center for IBM i the page you want is here. There have not been many changes to this particular subject, but you'really better off using the right reference. – WarrenT May 11 '15 at 16:02
  • Also, it is good practice to put a TEXT() description on your record formats and all the PF fields. – WarrenT May 11 '15 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.